only root can send out mail by postfix
2013-08
I have postfix installed and running. The problem is only root can send email. other users failed to do. Here is the log for user www-data which is a web server application. (the same error for other users)
postfix/smtp[32003]: 513765FEB9: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:11125, delay=2.1, delays=0.07/0/1.7/0.32, dsn=5.0.0, status=bounced (host 127.0.0.1[127.0.0.1] said: 550-Verification failed for <[email protected]> 550-Unrouteable address 550 Sender verify failed (in reply to RCPT TO command))
here is the /etc/postfix/main.cf:
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, localhost.$mydomain, localhost
relayhost = [127.0.0.1]:11125
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/lizard_password
smtp_sasl_security_options =
mynetworks = 127.0.0.1/8 [::ffff:127.0.0.1]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
myorigin = /etc/mailname
mydestination = $myhostname, localhost.$mydomain, localhost
inet_protocols = ipv4
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
and here is the section that I added to the /etc/stunnel/stunnel.conf:
[smtp-tls-wrapper]
accept = 11125
client = yes
connect = smtp.mydomain.com:465
I appreciate any help.
550-Verification failed for <[email protected]> 550-Unrouteable address 550 Sender verify failed (in reply to RCPT TO command))
Gmail is rejecting the message because the sender address is not routable (i.e. localhost.localdomain
doesn't exist in DNS). You need to specify a valid From address when sending your mail.
It's probably not related to your problem, but you shouldn't be using stunnel -- Postfix can do SSL by itself.
Not a postfix expert, but I'm going to guess it has something to do with reject_unauth_destination
From the manual:
reject_unauth_destination
Reject the request unless one of the following is true:
Postfix is mail forwarder: the resolved RCPT TO domain matches $relay_domains or a subdomain thereof, and contains no
sender-specified routing (user@elsewhere@domain),
Postfix is the final destination: the resolved RCPT TO domain matches $mydestination, $inet_interfaces, $proxy_interfaces,
$virtual_alias_domains, or $virtual_mailbox_domains, and contains no
sender-specified routing (user@elsewhere@domain).
My laptop running ubuntu.
I've just finished running:
sudo apt-get install php-pear
sudo pear install mail
sudo pear install Net_SMTP
sudo pear install Auth_SASL
sudo pear install mail_mime
sudo apt-get install postfix
and I choose "website" in the configuration instead of "localhost"
and then I send email to gmail. But the email still not arrived..
I dont know why this not works.
It sounds like you're setting up a local development environment on your laptop for Drupal.
If this is true, then there's a couple of ways you can go about this (note: I don't use Ubuntu Desktop very much besides Web surfing, so there may be point-and-click ways to achieve the following):
send all your test emails to a local account. You need to configure Postfix as 'local only' (if you run
sudo dpkg-reconfigure postfix
it'll ask you again how you want to configure your mail system. Choose local only, and choose your hostname.local or whatever as your mail domain) and then you can usemutt
as a simple mail client through Terminal.
This is probably the easiest and again, if you're doing dev work, you don't have to worry about sending mail out to real addresses by mistake, SMTP blocking on home connections, or even an Internet connection for that matter.If you really need to send to Internet email addresses, you'll have better luck setting up gmail as your smarthost and reconfiguring Postfix as "Satellite with Smarthost" in the
dpkg-reconfigure postfix
setup. There's a bit more to it, but this has been covered quite a bit on ServerFault. By using gmail as your smarthost on an alternative port (tcp 587), you can get around ISP firewalls blocking SMTP and should be able to send email out of most Internet connections.
As for Drupal, it's been a while, but I believe by default (and as with most PHP applications), it'll use whatever is configured in the /etc/php5/apache/php.ini
file's sendmail_path
setting, but by default, it'll use Postfix's built-in sendmail
wrapper on the localhost (your laptop) so you shouldn't need to change anything there.
Perhaps someone else can clarify that and I'll update my answer accordingly.