4

I'm trying to send a mail with sendmail. When sending the mail, I don´t get any errors in the logs, but when I look into my mailbox, the mail isn´t there, not even in the spam folder. I get some infos in the mail.log file from my var/log directory, but can´t really figure out, what I have to change, to get it working.

Here´s my development.rb part:

config.action_mailer.delivery_method = :sendmail
config.action_mailer.raise_delivery_errors = true

I tried with two different addresses and got different messages: this is from my mail.log:

Feb 16 13:55:22 localhost postfix/master[2821]: daemon started -- version 2.8.4, configuration /etc/postfix  
Feb 16 13:55:22 localhost postfix/pickup[2822]: 5E1C6CB8C1: uid=501 from=<fhu@informatik.uni-kiel.de>  
Feb 16 13:55:22 localhost postfix/cleanup[2824]: 5E1C6CB8C1: message-id=<4f3cfcba50ccf_ac695d96210305e1@localhost.mail>  
Feb 16 13:55:22 localhost postfix/qmgr[2823]: 5E1C6CB8C1: from=<fhu@informatik.uni-kiel.de>, size=882, nrcpt=1 (queue active)  
Feb 16 13:55:27 localhost postfix/smtp[2826]: 5E1C6CB8C1: to=<mkh@informatik.uni-kiel.de>, relay=miraculix.informatik.uni-kiel.de[134.245.248.198]:25, delay=5.3, delays=0.04/0.01/5.3/0.04, dsn=5.7.1, status=bounced (host miraculix.informatik.uni-kiel.de[134.245.248.198] said: 550 5.7.1 HELO localhost.localhost from RFC 2606 reserved domains blocked (in reply to MAIL FROM command))  
Feb 16 13:55:27 localhost postfix/cleanup[2824]: C0D2ACB8CB: message-id=<20120216125527.C0D2ACB8CB@localhost.localhost>  
Feb 16 13:55:27 localhost postfix/bounce[2829]: 5E1C6CB8C1: sender non-delivery notification: C0D2ACB8CB  
Feb 16 13:55:27 localhost postfix/qmgr[2823]: C0D2ACB8CB: from=<>, size=2932, nrcpt=1 (queue active)  
Feb 16 13:55:27 localhost postfix/qmgr[2823]: 5E1C6CB8C1: removed  
Feb 16 13:55:33 localhost postfix/smtp[2826]: C0D2ACB8CB: to=<fhu@informatik.uni-kiel.de>, relay=miraculix.informatik.uni-kiel.de[134.245.248.198]:25, delay=5.2, delays=0/0/5.2/0.04, dsn=5.7.1, status=bounced (host miraculix.informatik.uni-kiel.de[134.245.248.198] said: 550 5.7.1 HELO localhost.localhost from RFC 2606 reserved domains blocked (in reply to MAIL FROM command))  
Feb 16 13:55:33 localhost postfix/qmgr[2823]: C0D2ACB8CB: removed  

second adress:

Feb 16 13:56:22 localhost postfix/master[2821]: master exit time has arrived  
Feb 16 13:58:30 localhost postfix/master[2835]: daemon started -- version 2.8.4, configuration /etc/postfix  
Feb 16 13:58:30 localhost postfix/pickup[2836]: 91FFCCB947: uid=501 from=<xxx@informatik.uni-kiel.de>  
Feb 16 13:58:30 localhost postfix/cleanup[2838]: 91FFCCB947: message-id=<4f3cfd7684947_ac695dc9a5c306de@localhost.mail>  
Feb 16 13:58:30 localhost postfix/qmgr[2837]: 91FFCCB947: from=<xxx@informatik.uni-kiel.de>, size=878, nrcpt=1 (queue active)  
Feb 16 13:58:30 localhost postfix/smtp[2840]: connect to mx.freenet.de[2001:748:100:40::8:110]:25: No route to host  
Feb 16 13:58:30 localhost postfix/smtp[2840]: connect to mx.freenet.de[2001:748:100:40::8:112]:25: No route to host  
Feb 16 13:58:30 localhost postfix/smtp[2840]: connect to mx.freenet.de[2001:748:100:40::8:111]:25: No route to host  
Feb 16 13:58:30 localhost postfix/smtp[2840]: 91FFCCB947: to=<xxx@freenet.de>, relay=mx.freenet.de[195.4.92.9]:25, delay=0.32, delays=0.04/0.01/0.23/0.04, dsn=5.0.0, status=bounced (host mx.freenet.de[195.4.92.9] said: 550 Submission from dynamic IP 82.83.107.102 requires authentication (in reply to RCPT TO command))  
Feb 16 13:58:30 localhost postfix/cleanup[2838]: DF128CB94C: message-id=<20120216125830.DF128CB94C@localhost.localhost>  
Feb 16 13:58:30 localhost postfix/bounce[2843]: 91FFCCB947: sender non-delivery notification: DF128CB94C  
Feb 16 13:58:30 localhost postfix/qmgr[2837]: DF128CB94C: from=<>, size=2864, nrcpt=1 (queue active)  
Feb 16 13:58:30 localhost postfix/qmgr[2837]: 91FFCCB947: removed  
Feb 16 13:58:36 localhost postfix/smtp[2840]: DF128CB94C: to=<xxx@informatik.uni-kiel.de>, relay=miraculix.informatik.uni-kiel.de[134.245.248.198]:25, delay=5.3, delays=0/0/5.3/0.04, dsn=5.7.1, status=bounced (host miraculix.informatik.uni-kiel.de[134.245.248.198] said: 550 5.7.1 HELO localhost.localhost from RFC 2606 reserved domains blocked (in reply to MAIL FROM command))  
Feb 16 13:58:36 localhost postfix/qmgr[2837]: DF128CB94C: removed  
~              

In my user_mailer.rb I have this:

default :from => "xxx@informatik.uni-kiel.de"

Also I tried

config.action_mailer.sendmail_settings = 
    { :arguments => '-i -t -f xxx@informatik.uni-kiel.de'}

then the mail.log still looks like this:

Feb 16 14:54:57 localhost postfix/master[2893]: daemon started -- version 2.8.4, configuration /etc/postfix  
Feb 16 14:54:57 localhost postfix/qmgr[2895]: 9DBF4CB857: from=<xxx@informatik.uni-kiel.de>, size=859, nrcpt=1 (queue active)
Feb 16 14:54:58 localhost postfix/pickup[2894]: A3120CC90B: uid=501 from=<xxx@informatik.uni-kiel.de>  
Feb 16 14:54:58 localhost postfix/cleanup[2896]: A3120CC90B: message-id=<4f3d0ab19405d_b4999f2bd74125b1@localhost.mail>  
Feb 16 14:54:58 localhost postfix/qmgr[2895]: A3120CC90B: from=<xxx@informatik.uni-kiel.de>, size=880, nrcpt=1 (queue active)  
Feb 16 14:54:58 localhost postfix/smtp[2906]: connect to mx.freenet.de[2001:748:100:40::8:111]:25: No route to host  
Feb 16 14:54:58 localhost postfix/smtp[2906]: connect to mx.freenet.de[2001:748:100:40::8:112]:25: No route to host  
Feb 16 14:54:58 localhost postfix/smtp[2906]: connect to mx.freenet.de[2001:748:100:40::8:110]:25: No route to host  
Feb 16 14:54:58 localhost postfix/smtp[2906]: A3120CC90B: to=<xxx@freenet.de>, relay=mx.freenet.de[195.4.92.212]:25, delay=1.3, delays=1/0.01/0.17/0.05, dsn=5.0.0, status=bounced (host mx.freenet.de[195.4.92.212] said: 550 Submission from dynamic IP 82.83.107.102 requires authentication (in reply to RCPT TO command))  
Feb 16 14:54:58 localhost postfix/cleanup[2896]: E3597CC90F: message-id=<20120216135458.E3597CC90F@localhost.localhost>  
Feb 16 14:54:58 localhost postfix/qmgr[2895]: E3597CC90F: from=<>, size=2868, nrcpt=1 (queue active)  
Feb 16 14:54:58 localhost postfix/bounce[2907]: A3120CC90B: sender non-delivery notification: E3597CC90F  
Feb 16 14:54:58 localhost postfix/qmgr[2895]: A3120CC90B: removed  
~                                                                            

I tried to telnet mx.freenet.de 25 and got a connection. I would really appreciate any help.

Thanks!

shingara
  • 46,608
  • 11
  • 99
  • 105
Maike Hargens
  • 73
  • 1
  • 7
  • welcome to stackoverflow. Remember to upvote useful answers (including those to others' questions.) And to "Accept" (check) the one answer to your questions which best solves your problem. In case of ties, Accept the first answer (check the time info above the authors' name.) – Larry K Feb 16 '12 at 15:20

1 Answers1

3

ActionMailer is working correctly and sending the message to postfix via the sendmail api.

But postfix is bouncing the message because the sender machine name in the HELO command is localhost.localhost.

Set the sender's host and name in rails and it should work better.

docs

It could be that you need to set the host at the operating system level (not rails). Ask on the superuser list. See what happens when you give the hostname command to the OS. If it returns "localhost.localhost" then that's the first problem to fix.

Larry K
  • 47,808
  • 15
  • 87
  • 140
  • Thanks for the quick answer, I edited my post with the from field, which still didn´t solve it. hostname gives me just localhost. What should it be? – Maike Hargens Feb 16 '12 at 13:59
  • If I now have to set it at the operation system level, what happens in production? – Maike Hargens Feb 16 '12 at 14:03
  • Your production machine must also have a valid hostname. It probably already does. You should use different host names for the two machines (development and production). Note that the email recipients do not usually see the hostname of the sender. They see the From address info. – Larry K Feb 16 '12 at 14:18
  • How would I set the host for sendmail? Do I also have to set smpt settings? Thanks a lot for your help! – Maike Hargens Feb 16 '12 at 14:36
  • See [post](http://www.ducea.com/2006/08/07/how-to-change-the-hostname-of-a-linux-system/) or google for set linux hostname. Remember that the domainname needs to be set too. – Larry K Feb 16 '12 at 15:18
  • Also, I see from your 2nd log, that your latest problem is lack of smtp authentication for your dev machine. Ask on superusers to get this fixed. – Larry K Feb 16 '12 at 15:24