Hello,
I have two identical CentOS 6.2 machines with stock Postfix package and unchanged config:
# rpm -qa|grep post postfix-2.6.6-2.2.el6_1.x86_64
# postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 html_directory = no inet_interfaces = localhost inet_protocols = all mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES sample_directory = /usr/share/doc/postfix-2.6.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop unknown_local_recipient_reject_code = 550
On both machines I have appended
afarber: Alexander.Farber@gmail.com root: Alexander.Farber@gmail.com
to the /etc/aliases and run "newaliases".
Both machines have several cronjobs and logwatch.
One machine is a database server, I receive its cronjob mails just fine.
The other machine (preferans.de) is running Drupal 7. I've configured it's MX records to point to Google Apps, so that I can receive mails addressed to that domain and this works well.
Also I've set Drupal's From address to webmaster@prеferans.de and so sending mails by Drupal (for its user registration) works too.
But sending mails to my Gmail address by cronjobs doesn't work. I suspect this happens, because Google is too clever and it thinks that mails coming from "preferans.de" shouldn't have the From header set to "afarber@static.169.40.9.176.clients.your-server.de"
Jan 20 09:34:10 static sendmail[10577]: q0K8Y7mj010577: from=afarber, size=201, class=0, nrcpts=1, msgid=201201200834.q0K8Y7mj010577@static.169.40.9.176.clients.your-server.de, relay=afarber@localhost Jan 20 09:34:10 static postfix/smtpd[10578]: connect from localhost.localdomain[127.0.0.1] Jan 20 09:34:10 static postfix/smtpd[10578]: 9B84B31EA0A1: client=localhost.localdomain[127.0.0.1] Jan 20 09:34:10 static postfix/cleanup[10581]: 9B84B31EA0A1: message-id=201201200834.q0K8Y7mj010577@static.169.40.9.176.clients.your-server.de Jan 20 09:34:10 static sendmail[10577]: q0K8Y7mj010577: to=afarber, ctladdr=afarber (500/500), delay=00:00:03, xdelay=00:00:00, mailer=relay, pri=30201, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 9B84B31EA0A1) Jan 20 09:34:10 static postfix/qmgr[10025]: 9B84B31EA0A1: from=afarber@static.169.40.9.176.clients.your-server.de, size=823, nrcpt=1 (queue active) Jan 20 09:34:10 static postfix/smtp[10582]: connect to static.169.40.9.176.clients.your-server.de[176.9.40.169]:25: Connection refused Jan 20 09:34:10 static postfix/smtp[10582]: 9B84B31EA0A1: to=afarber@static.169.40.9.176.clients.your-server.de, relay=none, delay=0.14, delays=0.12/0.01/0.01/0, dsn=4.4.1, status=deferred (connect to static.169.40.9.176.clients.your-server.de[176.9.40.169]:25: Connection refused)
So does anybody please have an advice on how to fix my cronjob mails?
Regards Alex
Am 20.01.2012 09:38, schrieb Alexander Farber:
Hello,
I have two identical CentOS 6.2 machines with stock Postfix package and unchanged config:
# rpm -qa|grep post postfix-2.6.6-2.2.el6_1.x86_64
# postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 html_directory = no inet_interfaces = localhost inet_protocols = all mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES sample_directory = /usr/share/doc/postfix-2.6.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop unknown_local_recipient_reject_code = 550
On both machines I have appended
afarber: Alexander.Farber@gmail.com root: Alexander.Farber@gmail.com
to the /etc/aliases and run "newaliases".
Both machines have several cronjobs and logwatch.
One machine is a database server, I receive its cronjob mails just fine.
The other machine (preferans.de) is running Drupal 7. I've configured it's MX records to point to Google Apps, so that I can receive mails addressed to that domain and this works well.
Also I've set Drupal's From address to webmaster@prеferans.de and so sending mails by Drupal (for its user registration) works too.
But sending mails to my Gmail address by cronjobs doesn't work. I suspect this happens, because Google is too clever and it thinks that mails coming from "preferans.de" shouldn't have the From header set to "afarber@static.169.40.9.176.clients.your-server.de"
Jan 20 09:34:10 static sendmail[10577]: q0K8Y7mj010577: from=afarber, size=201, class=0, nrcpts=1, msgid=201201200834.q0K8Y7mj010577@static.169.40.9.176.clients.your-server.de, relay=afarber@localhost Jan 20 09:34:10 static postfix/smtpd[10578]: connect from localhost.localdomain[127.0.0.1] Jan 20 09:34:10 static postfix/smtpd[10578]: 9B84B31EA0A1: client=localhost.localdomain[127.0.0.1] Jan 20 09:34:10 static postfix/cleanup[10581]: 9B84B31EA0A1: message-id=201201200834.q0K8Y7mj010577@static.169.40.9.176.clients.your-server.de Jan 20 09:34:10 static sendmail[10577]: q0K8Y7mj010577: to=afarber, ctladdr=afarber (500/500), delay=00:00:03, xdelay=00:00:00, mailer=relay, pri=30201, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as 9B84B31EA0A1) Jan 20 09:34:10 static postfix/qmgr[10025]: 9B84B31EA0A1: from=afarber@static.169.40.9.176.clients.your-server.de, size=823, nrcpt=1 (queue active) Jan 20 09:34:10 static postfix/smtp[10582]: connect to static.169.40.9.176.clients.your-server.de[176.9.40.169]:25: Connection refused Jan 20 09:34:10 static postfix/smtp[10582]: 9B84B31EA0A1: to=afarber@static.169.40.9.176.clients.your-server.de, relay=none, delay=0.14, delays=0.12/0.01/0.01/0, dsn=4.4.1, status=deferred (connect to static.169.40.9.176.clients.your-server.de[176.9.40.169]:25: Connection refused)
So does anybody please have an advice on how to fix my cronjob mails?
Regards Alex
Hi Alex,
the log shows a broken setup. The system is both using Sendmail *and* Postfix. Most probably the fix is to run alternatives --config mta and to select Postfix, to make sure all the symlinks are set properly. You may even yum remove sendmail afterwards.
Relaying through Google, make sure that $myhostname is valid. Actually it translates to your invalid hostname localhost with domain part localdomain. Fix that!
Regards
Alexander
Am 20.01.2012 09:47, schrieb Alexander Dalloz:
Am 20.01.2012 09:38, schrieb Alexander Farber:
# postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 html_directory = no inet_interfaces = localhost inet_protocols = all mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES sample_directory = /usr/share/doc/postfix-2.6.6/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop unknown_local_recipient_reject_code = 550
On both machines I have appended
afarber: Alexander.Farber@gmail.com root: Alexander.Farber@gmail.com
to the /etc/aliases and run "newaliases".
Hi Alex,
the log shows a broken setup. The system is both using Sendmail *and* Postfix. Most probably the fix is to run alternatives --config mta and to select Postfix, to make sure all the symlinks are set properly. You may even yum remove sendmail afterwards.
Relaying through Google, make sure that $myhostname is valid. Actually it translates to your invalid hostname localhost with domain part localdomain. Fix that!
Regards
Alexander
To make an add and correction. You do not relay through gmail, but you address your own gmail.com address. So you do not SMTP AUTH but you appear as a normal mail sender to gmail. And all their anti-spam measures act.
So make sure *verything* is setup properly acting as an MTA in the public internet. Means, correct, resolvable DNS (forward and reverse, matching). Valid addresses (root@localhost.localdomain is NOT).
Advise: Use the MTA by your ISP as your relay host.
Alexander
Hello,
thank you for your reply.
I'd like to provide 2 quick additional details before trying your suggestions:
1) If I add a from address at the command line, then mail is delivered ok:
$ mail Alеxander.Farber@gmail.com -r wеbmaster@prеferans.de
But if I just run
$ mail Аlеxander.Farber@gmail.com
then it is rejected by Gmail.
So I could append "| mail -r wеbmaster@preferans.de" to all my cronjobs, but I'm looking for better solution
2) My ISP (hetzner.de) doesn't provide mail relaying at all.
Regards Alex
Am 20.01.2012 09:57, schrieb Alexander Farber:
Hello,
thank you for your reply.
I'd like to provide 2 quick additional details before trying your suggestions:
If I add a from address at the command line, then mail is delivered ok:
$ mail Alеxander.Farber@gmail.com -r wеbmaster@prеferans.de
That's because "mail -r" sets the envelope from address.
But if I just run
$ mail Аlеxander.Farber@gmail.com
then it is rejected by Gmail.
Very certainly because the envelope from is then localhost.localdomain. Just check what "hostname" tells you. As you did not configure your MTA the defaults are acting.
So I could append "| mail -r wеbmaster@preferans.de" to all my cronjobs, but I'm looking for better solution
That is not advised.
You have a host in the public internet which sends emails. So take care for everything involved and do not try to hack around your single problem now. Your MTA needs a proper self-identification when sending out.
- My ISP (hetzner.de) doesn't provide mail relaying at all.
Ok.
I can see that your domain preferans.de resolves forward and reverse. The MX is set to Google mail. Your smart host (as much as you would have need for it) would be gmail. You have credentials, so you could do SMTP AUTH. Though, as alexander.farber@gmail.com is the destination address, Google mail has no need to relay to a further mail hop.
Regards Alex
Alexander
Hello, thank you for all the replies.
I've solved my current problem by going back to sendmail (which I'm better used than to postfix) and adding this line to the stock CentOS sendmail.mc:
MASQUERADE_AS(`preferans.de')dnl
Yes, I use Google Apps for incoming mail and that is why I have their MX servers.
I also been using GMail and SMTP AUTH before - but I've removed that now, because I couldn't set the From or Reply-To header with that solution - Google was always rewriting it and thus it was bad for my Drupal site (users can't send mails to other users).
Regards Alex