KoRoVaMiLK# linux microblog

  • Random
  • Archive
  • RSS
  • Ask me anything

Postfix Mail Relay in a few easy steps [CentOS 6 tested]

First of all we install postfix package (if not already installed):

yum -y install postfix

It’s always a good idea to have a backup:

cp -rvp /etc/postfix/  /etc/postfix.SAFE

Now let’s edit main config file /etc/postfix/main.cf with your details:

myhostname = given.hostname

mynetworks = 10.0.0.0/16, 192.168.1.0/24, 127.0.0.0/8 (your networks)

Now set the outgoing credentials in this new file /etc/postfix/sasl_passwd:

smtp.domain.com your.username@domain.com:YOUR.PASSWORD.HERE

Set the correct ownership permissions :

chown root:root /etc/postfix/sasl_passwd
chmod 0600 /etc/postfix/sasl_passwd

Now create an hashed db for the credentials set above:

postmap hash:/etc/postfix/sasl_passwd

Here you go! Now turn off sendmail (which is the default mail transport agent on CentOS installations) and switch on postfix:

chkconfig sendmail off

chkconfig postfix on

/etc/init.d/sendmail stop

/etc/init.d/postfix start

In order to test outgoing mail service is working you may refer to my previous post (http://korovamilky.tumblr.com/post/25436469384/sendmail-one-liner) while tailing on another shell the mail log as follows:

tail -f /var/log/maillog

** enjoy! **

    • #sendmail
    • #postfix
    • #linux
    • #centos
    • #mail
    • #relay
    • #MTA
  • 11 months ago
  • 1
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Common Zimbra outgoing mail issues behind NAT

Setup Zimbra Collaboration Suite on a cloud server without public interface (read: behind NAT) may waste you an afternoon trying to figure out why local emails (same domain) are not delivered, while sending/receiving mail from/to the internet works flawless.

You may find something like this on your /var/log/zimbra.log:

May  7 04:32:39 mail postfix/lmtp[15305]: connect to mail.mydomain.com[XXX.XXX.XXX.XXX]:25: Connection timed out

where XXX.XXX.XXX.XXX is the public ip address of your zimbra server.

Problem is that Zimbra MTA performs DNS lookups for local mail delivery by default. Check your Zimbra configuration and you will find out the trick:

su - zimbra
zmlocalconfig | grep postfix_lmtp_host_lookup
postfix_lmtp_host_lookup = dns


Now, let’s fix it:
su - zimbra
zmlocalconfig -e postfix_lmtp_host_lookup=native


then restart the MTA:

zmmtactl restart

Note that you *MUST* flag “Enable DNS lookups” under “Server settings” / “MTA” or outgoing mail will stop to work.

    • #dns
    • #linux
    • #zimbra
    • #mta
    • #mail
    • #zcs
  • 1 year ago
  • Permalink
Share

Short URL

TwitterFacebookPinterestGoogle+

Logo

KoRoVaMiLK# linux microblog

something more than a tweet, slightly less than a real blog.. somewhere around a technical sketchpad

Pages

  • bio
  • links

about:me

  • Linkedin Profile
  • korovamilk on github

@korovamilky tweets

loading tweets…

Top

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Mobile
Effector Theme by Pixel Union