Hi all, 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 at hotmail.com should i setup a default smtp to use? where can i check for the errors that are taking place?
Look for erros in /var/log/maillog. Do you have sendmail running? On Fri, Jan 15, 2010 at 11:15 AM, Roland Roland <R_O_L_A_N_D at hotmail.com> wrote:> Hi all, > > 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 at hotmail.com > > should i setup a default smtp to use? where can i check for the errors > that are taking place? > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-- Lincoln Zuljewic Silva More contact info.: http://www.system.adm.br/contact.php "How often must a question be asked before it?s considered a frequently asked question?"
At Fri, 15 Jan 2010 15:15:48 +0200 CentOS mailing list <centos at centos.org> wrote:> > Hi all, > > 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 at hotmail.com > > should i setup a default smtp to use? where can i check for the errors > that are taking place?If it is a default CentOS install, you should have sendmail installed, but you probably need to install sendmail-cf and create a site specific sendmail.cf file (from a site specific sendmail.mc file). Look in /var/log/maillog for error messages. The 'mail' command is the correct thing to use, except you need to bind stdin to something. Eg: df -h | mail -s "Disk space report" mumble at whatever.com or mail -s "Disk space alert!" mumble at whatever.com </dev/null> _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos > > >-- Robert Heller -- 978-544-6933 Deepwoods Software -- Download the Model Railroad System http://www.deepsoft.com/ -- Binaries for Linux and MS-Windows heller at deepsoft.com -- http://www.deepsoft.com/ModelRailroadSystem/
From: Roland Roland <R_O_L_A_N_D at hotmail.com>> 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 at hotmail.com > > should i setup a default smtp to use? where can i check for the errors > that are taking place?Tried with sendmail service started...? Check /var/log/maillog An other way: /usr/sbin/sendmail -t <<EOF Subject: ... to: ... Content-type: text/plain Hello World... EOF JD
Roland Roland wrote:> Hi all, > > 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 at hotmail.com > > should i setup a default smtp to use? where can i check for the errors > that are taking place?Does your machine have a valid domain name? Most places will reject mail if the From: address can't be resolved, and the mail program will use the user running the command and the host name to construct this address. Look in /var/log/maillog to see if that is the problem. -- Les Mikesell lesmikesell at gmail.com
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 at hotmail.com > > 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 at alice.it" % SENDMAIL, "w") p.write("To: gayleard at eircom.net\r\n") p.write("From: Timothy Murphy <gayleard at alice.it>\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
Here is what I use: mail -s "My email subject" me at domain.com <$myfile On some (older?) systems the command is email instead of mail. Check man mail Regards, Jussi On 15.1.2010 15:15, Roland Roland wrote:> Hi all, > > 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 at hotmail.com > > should i setup a default smtp to use? where can i check for the errors > that are taking place? > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >-- Jussi Hirvi * Green Spot Topeliuksenkatu 15 C * 00250 Helsinki * Finland Tel. +358 9 493 981 * Mobile +358 40 771 2098 (only sms) jussi.hirvi at greenspot.fi * http://www.greenspot.fi
If you're using a typical residential broadband ISP, outbound SMTP may also be blocked by your provider as a mechanism to minimize mail abuse (spam). In such a case, you will need to configure your MTA (sendmail or whatever) to forward all mail through your ISP's official outbound mail server. You can check this by issuing the command: telnet mx1.hotmail.com smtp (Note the second 'smtp' argument there.) If you see something like the following, then type "quit" (no quotes) and hit enter/return: Trying 65.55.92.152... Connected to mx1.hotmail.com. Escape character is '^]'. 220 snt0-mc2-f42.Snt0.hotmail.com Sending unsolicited commercial or bulk e-mail to Microsoft's computer network is prohibited. Other restrictions are found at http://privacy.msn.com/Anti-spam/. Violations will result in use of equipment located in California and other states. Fri, 15 Jan 2010 08:54:58 -0800 If it doesn't do anything after "Trying 65.55.92.152..." or gives you a connection refused, your ISP is blocking SMTP. If your telnet appears hung, type control-] (right square bracket) to get to the telnet prompt, then type "quit" (no quotes) and enter/return. Devin