Today I had to figure out, how an Atmail server, which uses Exim as mail server process, can accept local e-mails, e.g. sent through mailx.
Postfix is also installed on the same machine and Postfix is called from the system. But even when I configured Postfix to use the local ip and the exim port, the mail was rejected by exim with the following error:
Oct 25 12:49:46 atmail postfix/smtp: CD2CF41791: to=
The problem is, that Atmail/exim checks if the sender address exists in the atmail database and/or if the sender address is valid. But as I'm on the same server I don't really care about verification and just want exim to accept the mail.
After a lot of try'n'err I finally got it working with the following configuration.
1. Set up Postfix as "local mailserver" besides Atmail/Exim but let it run under a different port.
Port 25 is already in use by Atmail/Exim, therefore the listening port needs to be changed in /etc/postfix/master.cf:
#smtp inet n - n - - smtpd # was
2525 inet n - n - - smtpd
In the very first (not commented-out) line is the standard listening definition. By default Postfix should listen on the smtp port, which is 25. But in this case I replaced smtp by "2525".
2. Make some Postfix modifications.
If not already done, set the correct hostname (fqdn) in Postfix's configuration (main.cf):
myhostname = mymailserver.example.com
Also set the relayhost to the same IP-address as this server (localhost or 127.0.0.1 won't work) with port 25 (= Exim):
relayhost = 192.168.23.23:25
Then start Postfix and verify the listening ports:
[root@mymailserver]# /etc/init.d/postfix start
[root@mymailserver]# netstat -lntp | grep 25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 5081/exim
tcp 0 0 127.0.0.1:2525 0.0.0.0:* LISTEN 5711/master
3. Edit the Exim configuration file.
Add a line which defines the server's IP address in the acl_check_rcpt part but, very important, BEFORE the #
# Accept if the source is local SMTP (i.e. not over TCP/IP). We do this by
# testing for an empty sending host field.
accept hosts = :
accept hosts = 192.168.23.23
# Deny unless the sender address can be verified.
require verify = sender
In the case of Atmail, this Exim configure file is found in /usr/local/atmail/mailserver/configure.
After this, restart the Exim process:
pkill -HUP exim
4. Send a local e-mail and check logs.
[root@mymailserver]# echo "This is a testmail from Postfix to Exim on same server" | mailx -s "Mailserver-Talk" firstname.lastname@example.org
[root@mymailserver]# tail /var/log/mail.log
Oct 25 13:22:48 mymailserver postfix/pickup: 91D5241791: uid=0 from=
Oct 25 13:22:48 mymailserver postfix/cleanup: 91D5241791: message-id=<20121025132248.91D5241791@mymailserver.example.com>
Oct 25 13:22:48 mymailserver postfix/qmgr: 91D5241791: from=
Oct 25 13:22:49 mymailserver postfix/smtp: 91D5241791: to=
Oct 25 13:22:49 mymailserver postfix/qmgr: 91D5241791: removed
[root@mymailserver]# tail /usr/local/atmail/mailserver/spool/log/mainlog
2012-10-25 13:22:49 1TRNOa-0001Uu-L8 <= email@example.com H=mymailserver.example.com (mymailserver.example.com) [192.168.23.23] P=esmtp S=1448 id=20121025132248.91D5241791@mymailserver.example.com
2012-10-25 13:22:49 1TRNOa-0001Uu-L8 => user
2012-10-25 13:22:49 1TRNOa-0001Uu-L8 Completed
Maybe there's a simpler or better solution to that, but as I'm not at all an Exim dude, I'm already happy that it works. If you do have a better solution, please comment.
No comments yet.
AWS Android Ansible Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Consul Container Containers CouchDB DB DNS Database Databases Docker ELK ElasticSearch Elasticsearch Filebeat FreeBSD GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Icingaweb2 InfluxDB Internet Java Kibana Kubernetes LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Rancher SSL Security Shell SmartOS Solaris Surveillance SystemD TLS Tomcat Ubuntu Unix VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder