Re: how to send mail from console

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Roland Roland wrote:

> i'm trying to get a script to send me an email whenever a certain
> condition takes place..
> i'm afraid i dont have experience with mail command nor anything else
> related to sending emails for that matter..
> 
> i googled a bit and tried using mutt and mail ...
> though i do not recieve any email in my inbox...
> 
> the command im using is the following : mail -s “disk space report”
> R_O_L_A_N_D@xxxxxxxxxxx
> 
> should i setup a default smtp to use? where can i check for the errors
> that are taking place?

I shouldn't really post this, as I am so far from being an expert,
but I use the following script to send (daily) the email address 
of a remote machine:
---------------------------------------
#!/usr/bin/python

SENDMAIL = "/usr/sbin/sendmail"
import os
import sys
import time
tt = time.ctime()
f = os.popen("stunbdc stun.ekiga.net 2>/dev/null")
ipaddr = f.read()
f.close()
p = os.popen("%s -t -fgayleard@xxxxxxxx" % SENDMAIL, "w")
p.write("To: gayleard@xxxxxxxxxx\r\n")
p.write("From: Timothy Murphy <gayleard@xxxxxxxx>\r\n")
p.write("Subject: Anghiari IP address\r\n")
p.write("\r\n")
p.write(tt + "\r\n")
p.write(ipaddr + "\r\n")
p.close()
sys.exit()
---------------------------------------

I found I have to add the -f switch (with a local address)
to satisfy the remote ISP.

But this is probably far from your needs.

-- 
Timothy Murphy  
e-mail: gayleard /at/ eircom.net
tel: +353-86-2336090, +353-1-2842366
s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux