So I have been scratching my head for a little while over how to get Postfix to deliver mail from my www.example.com site off to an external mail host, when the email address has the same domain, @example.com.

What I discovered is that I needed to do 3 things:

  1. Set my machine hostname to be distinct, ie www.example.com (vim up your /etc/hostname and then hostname -F /etc/hostname)
  2. Set mydomain and myhostname to both be the same as the machine hostname, www.example.com (this is in /etc/postfix/main.cf)
  3. Restarted postfix

The key here for me was to ensure that the hostname (and Postfixes mydomain setting) needed to be different from the actual domain of the email addresses I was trying to get mail delivered to. At that point, I didn't need to deal with local host files, or luser settings, etc. The Postfix program just sees it as an external mail address and pushes it out like any other mail. Yay!

There are a bunch of other things you should probably set as well if you are just setting up your Postfix, run /etc/postfix/post-install first-install-reminder for a fun reminder of what you need to do. http://postfix.org is also a good resource for getting things setup.

Anybody that knows a better way, please comment!

great, I had the same problem

great, I had the same problem and your solution worked like a breeze. Thanks, Ornela from teeth whitening

Enlist in the army, you will

Enlist in the army, you will have a good death yea

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

Powered by Drupal, an open source content management system