Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
using ssmtp for cron
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
schmutzfinger
Veteran
Veteran


Joined: 26 Oct 2003
Posts: 1287
Location: Dresden/Germany

PostPosted: Tue Mar 01, 2005 9:25 pm    Post subject: using ssmtp for cron Reply with quote

I am working on the setup for ssmtp for a while now. And it seems to me, that this tool is not as simple as the dev's tell us.
First of all i don't know if i understand the ssmtp.conf.
Quote:

# Where will the mail seem to come from?
rewriteDomain=mydomain.de

actually this line causes
Code:

root@myhostname# echo hello | mailto -s "hello" root

to send the mail to root@mydomain.de. And this is exactly the other way around I would expect from the comment.

After realising that I changed the configfile to this
Quote:

ssmtp.conf
-------
root=MyLocalLogin
# MyLocalLogin equals the login @ the isp
mailhub=mail.isp.de
rewriteDomain=isp.de
hostname=myhostname.isp.de

revalisases
-------
root:root@myhostname:mail.isp.de
henning:henning@myhostname:mail.isp.de


now the sendmail command would send a mail with
FROM= root@myhostname
TO= root@isp.de
ENVELOPE_TO= MyLocalLogin@isp.de

that means that MyLocalLogin@isp.de is the only one who will actually get the mail, but the TO field is wrong. I checked this and it works fine, so root@isp.de will not read your mail to your local root account. With this configuration i can send mails via sendmail from root and my user account over the mailhub of the isp.
But using "echo hello" as the input of the pipe does not realy take time so I didn't see another problem of this setup. Cron kept on writing /root/dead.letter and I finally figured out why. On my machine the logs said
Code:

/var/log/mail
  Mar  1 12:38:59 [sSMTP] Connection lost in middle of processing
/var/log/crond
  Mar  1 12:48:04 [/usr/sbin/cron] (root) MAIL (mailed 7915 bytes of output but got status 0x0001_)

this is what mail.isp.de has in its logs
Code:

2005-03-01 12:38:59 1D65dX-0005dS-00 SMTP data timeout (message abandoned) on connection from myhostname.isp.de
(myhostname.isp.de) [xxx.xxx.xxx.xxx]


It seems to me that this ssmtp already opens the connection to the mailserver when the process in front of the pipe starts. When this process takes more than the timeout time of the mailhub your mail will end up in dead.letter, and my cron jobs usually take a while.

Please tell me if you are using ssmtp to send your local mail through your isp. I don't know what i did wrong wrong here.

I think ssmtp is really bad documented and should not be the default MTA for a great distri like gentoo. I did not find one single thread where one used this tool sucessfully and could tell how he did it. Please don't tell me to use a real MTA. I wanted to give it a try because the dev's say it would be so easy and its default for gentoo.
Back to top
View user's profile Send private message
maguire
Tux's lil' helper
Tux's lil' helper


Joined: 27 May 2004
Posts: 103
Location: Longmont, Colorado

PostPosted: Wed Apr 13, 2005 8:15 pm    Post subject: Reply with quote

Thanks schmutzfinger!

I was having the same problem with cron output not being e-mailed, but rather ending-up in a "dead.letter" file. I couldn't figure-out what was causing the problem 'til I saw your post... Sure enough, I have the "connection lost" message in my mail log too!

'ssmtp' is working fine for my normal e-mail needs, but this 'cron' issue is not insignificant! Personally, I didn't *want* to install a full-blown MTA on my workstation---because all my mail goes out to a mail server and I uses POP3 to retrieve it, but I *did* want the ability to send e-mail from scripts, etc.

I'm going to try having my long-running 'cron' scripts write output to a temp file, and then e-mail that file within the script itself, which then means I can direct all output of the 'cron' line to /dev/null. If that works, I'll be satisfied, because I usually only want the 'cron' output while I'm debugging a long-running-in-the-middle-of-the-night process.

Thanks for the information!

Bruce.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum