10.3: Enable the postfix Mail Transfer Agent



Apple has now included Postfix instead of sendmail in Panther client and server. Here are the steps you need to do and watch out for if you want to enable this MTA on your client machine.
1. Edit the MAILSERVER=-NO- line in /etc/hostconfig. Change it to read MAILSERVER=-YES-. Save and exit the file.
2. Open up /etc/postfix/main.cf, and edit these lines to reflect your setup. These are examples from my setup; yours might be different.
LINE 67: myhostname = stibnite.oeyvind.org
LINE 75: mydomain = oeyvind.org
LINE 91: myorigin = $mydomain
LINE 105: inet_interfaces = all
LINE 152: mydestination = $myhostname, localhost.$mydomain
LINE 239: mynetworks_style = subnet
LINE 253: mynetworks = 192.168.0.0/23, 127.0.0.0/8
Save your work, and exit the file.
3. Open up /etc/postfix/master.cf, and uncomment line 77 -- change #smtp inet n - n - - smtpd to smtp inet n - n - - smtpd. Save and exit the file.
After a reboot, postfix MTA will be running.


______________________________________________



... Email hint • Print hint  
 


 

10.3: Enable the postfix Mail Transfer Agent
31 comments | Create New Account



The following comments are owned by whoever posted them. macosxhints is not responsible for what they say



10.3: Enable the postfix Mail Transfer Agent

Authored by: MtnBiker on Wed, Oct 29 '03 at 12:35PM

or in a package:

http://www.roadstead.com/weblog/Tutorials/PostfixEnabler.html

---
Hermosa Beach, CA USA

[ Reply to This ]
10.3: Enable the postfix Mail Transfer Agent - Authored by: MtnBiker on Wed, Oct 29 '03 at 12:57PM

10.3: Enable the postfix Mail Transfer Agent

Authored by: fabrizio on Wed, Oct 29 '03 at 12:40PM

You need not to reboot. Type "sudo Postfix start" in the Terminal. "sudo Postfix stop" when you want to halt the daemon.

[ Reply to This ]

10.3: Enable the postfix Mail Transfer Agent

Authored by: benoitc on Wed, Oct 29 '03 at 12:47PM

mmm, Don't need to reboot just type in terminal /System/Library/StartupItems/Postfix/Postfix start .

[ Reply to This ]
10.3: Enable the postfix Mail Transfer Agent - Authored by: inchhigh on Wed, Oct 29 '03 at 01:46PM

10.3: Enable the postfix Mail Transfer Agent

Authored by: wdavis0911 on Wed, Oct 29 '03 at 02:36PM

Major confusion:

I've been tring to enable postfix and had gotten to a point were it would send mail but to where I have no idea. It wouldn't error out nor would it send it to the mail box requested. So I followed the steps above (original post) and when I hit send for a test mail i had a kernal panic. Any idea how to get this working? Also for a domain can I make something up or use localhost or what? I'm tring to send mail only I can receive it form third party ISP's fine.

[ Reply to This ]
10.3: Enable the postfix Mail Transfer Agent - Authored by: wdavis0911 on Wed, Oct 29 '03 at 03:13PM
10.3: Enable the postfix Mail Transfer Agent - Authored by: BraindeadMac on Wed, Oct 29 '03 at 05:59PM
10.3: Enable the postfix Mail Transfer Agent - Authored by: wdavis0911 on Wed, Oct 29 '03 at 09:01PM
10.3: Enable the postfix Mail Transfer Agent - Authored by: wdavis0911 on Wed, Oct 29 '03 at 09:14PM
10.3: Enable the postfix Mail Transfer Agent - Authored by: dlhull on Fri, Feb 4 '05 at 08:28PM
10.3: Enable the postfix Mail Transfer Agent - Authored by: ffernandex on Tue, Feb 3 '04 at 03:59PM

10.3: Enable the postfix Mail Transfer Agent

Authored by: msvara on Wed, Oct 29 '03 at 03:42PM

I also had to fix the permissions before it was able to work.

[ Reply to This ]

THANK YOU!

Authored by: huzzam on Wed, Oct 29 '03 at 03:44PM

I'd been hitting my head against a wall for a whole day. I had postfix running fine for sending mail, but i had negelected to edit the master.cf so i couldn't receive anything. Thanks!

[ Reply to This ]

10.3: Enable the postfix Mail Transfer Agent

Authored by: pcp_ip on Wed, Oct 29 '03 at 03:51PM

Strange. First time I posted this it was added to the wrong hint...

If you did the upgrade option of 10.3 (and not archive or clean install) then the postfix user wasn't added to Netinfo. You'll be seeing errors like:
postfix: fatal: file /etc/postfix/main.cf: parameter mail_owner: unknown user name value: postfix

follow the instructions at xlr8yourmac to run the create users script that the upgrade didn't run.

[ Reply to This ]
10.3: Enable the postfix Mail Transfer Agent - Authored by: Beandip on Wed, Oct 29 '03 at 08:22PM
10.3: Enable the postfix Mail Transfer Agent - Authored by: jough on Wed, Nov 5 '03 at 10:20AM
10.3: Enable the postfix Mail Transfer Agent - Authored by: wappendorf on Thu, Nov 6 '03 at 10:53AM
10.3: Enable the postfix Mail Transfer Agent - Authored by: jough on Thu, Nov 6 '03 at 07:29PM

Need to comment out second inet_interfaces line at end of main.cf

Authored by: benlotto on Wed, Oct 29 '03 at 05:59PM

At the end of the main.cf file I found

# THE FOLLOWING DEFAULTS ARE SET BY APPLE
#
# bind to localhost only
#
inet_interfaces = localhost

which was changing the inet_interfaces = all that I had set above. If you have the same, you need to comment out the second inet_interfaces line, otherwise people won't be able to send you mail.


[ Reply to This ]
Need to comment out second inet_interfaces line at end of main.cf - Authored by: Beandip on Wed, Oct 29 '03 at 08:11PM

10.3: Enable the postfix Mail Transfer Agent

Authored by: dreness on Wed, Oct 29 '03 at 06:39PM

If MAILSERVER is set to AUTOMATIC (which is the default), then postfix-watch runs at startup. Its job is to watch the mail queue and fire up postfix when needed, then kill after a period of inactivity (1 hour, I think). This seems to be the resource conservationist approach, and may help on lower end systems (thanks jkh ;)

[ Reply to This ]

10.3: Enable the postfix Mail Transfer Agent

Authored by: schrammalama on Thu, Jan 22 '04 at 12:26PM

I'm a newbie here and need some perspective. I'm trying to set-up a mail server on my locally controlled web servering computer. I've read lots of articles, but nothing which spells out the mail infrastructe clearly. A couple of questions.
1. After setting up Postfix what next?
a. Can I now send out e-mail & receive it?
b. Do I need to set-up Cyrus, UW IMAP, or is there an Apple Mail Server already running? How do I do this?
2. How do I create new e-mail accounts?
3. Can I get AOL mail relayed to my new accounts?

Thanks,
Greg

[ Reply to This ]

10.3: Enable the postfix Mail Transfer Agent

Authored by: ffernandex on Tue, Feb 3 '04 at 03:51PM

I have a nice TUTORIAL explaining how to set up POSTFIX as an SMTP, I'll do a copy paste here, because i cannot add attachments...
(It's from MaxBulk Software, bear with the advertising...)

------------------
un you own Mac OS X v10.3 (Panther) Mail server in 5 minutes!
Send your e-mails with MaxBulk Mailer twice as fast bypassing your local ISP SMTP server...

This document is based on stepwise.com article by Graham Orndorff
http://www.stepwise.com/Articles/Workbench/eart.index.html - Copyright 2001 Graham Orndorff

Mac OS X v10.3 (Panther) is shipped with a built-in mail server that comes deactivated by default. This mail server, named "Postfix" is a high-performance UNIX SMTP (Simple Mail Transfer Protocol) server. Postfix can be setup in less than 5 minutes and can make your MaxBulk e-mails deliveries up as twice as fast. Furthermore you will no longer need to use your ISP server, no more authentication, no more mails per session limit... Postfix, as a full SMTP server, will deliver all your e-mails directly to the recipients mailboxes.

The good news: once your Mail server's running, you will be able to set any mail application to use it. This will boost all your day to day mail deliveries.

Note: At the time of writing, Mac OS 10.3 ships with 2.0.10 release of Postfix. This document assumes the reader is reasonably competent with unix, and has administrative rights on the system in question.


Table of Contents

1-. What is Postfix, and why should I use it?
2.- Enabling Postfix
3.- Troubleshooting
4.- Restarting Postfix
5.- How to set MaxBulk Mailer to use Postfix?
6.- Legal Disclaimer




1-. What is Postfix, and why should I use it?

Postfix is the built-in mail server on Mac OS X v10.3 (Panther). It is bundled with many Unix operating systems as well. By default, it is disabled for security purposes, but it can be enabled easily by making a small modifications. Enabling Postfix allows you to specify "localhost" as your outgoing mailserver. By enabling Postfix, you'll never have to change your mailserver settings again. Postfix is also quite fast.

To perform all the requested changes you will need to use the Terminal utility.


Terminal is located in the Applications/Utilities folder

2.- Enabling Postfix

To enable Postfix, open the Terminal and type

sudo pico /etc/hostconfig


Typing "sudo pico /etc/hostconfig"


Find the line that has "MAILSERVER=-NO-" or "MAILSERVER=-AUTOMATIC-" and change the "-NO-" or "-AUTOMATIC-" to "-YES-". Note: Control+V to go to next page and use the arrow keys to go up, down, right and left.


Changing "MAILSERVER=-NO-" to "MAILSERVER=-YES-"


Hit Control+'X', press 'Y' and return to save the changes to the file.

Next step is to create a 'postfix' group and a 'postdrop' account using following commands:
(Write one command at a time followed by a carriage return)

echo 'postfix:*:23456:postfix' | sudo niload group /
echo 'postdrop :*:23457:' | sudo niload group /
echo 'postfix:*:23456:23456::0:0:Mail:/tmp:/usr/bin/false' | sudo niload passwd /

Then we set Postfix directories owner with following commands:
(Write one command at a time followed by a carriage return)

sudo chown -R postfix /private/var/spool/postfix
sudo chown :postdrop /private/var/spool/postfix/public
sudo chown :postdrop /private/var/spool/postfix/maildrop
sudo chown :postdrop /usr/sbin/postqueue
sudo chown :postdrop /usr/sbin/postdrop

Next, you must adjust the Postfix configuration opening 'master.cf':

sudo pico /etc/postfix/master.cf


Typing "sudo pico /etc/postfix/master.cf"


Once on the file, go to next page (control+V) and uncoment the first smtp line:

#smtp inet n - n - - smtpd

this way:

smtp inet n - n - - smtpd

Note: Control+V to go to next page and use the arrow keys to go up, down, right and left.


Un-commenting line

Hit Control+'X', press 'Y' and return to save the changes to the file.

Next, you must adjust your domain and host name opening 'main.cf':

sudo pico /etc/postfix/main.cf

• Find the lines:

#myhostname = host.domain.tld
#myhostname = virtual.domain.tld

and add bellow:

myhostname = your.domain.tld (e.g. stan.maxprog.com)

• Find the line:

#myorigin = $mydomain

Uncomment it so it looks like this:

myorigin = $mydomain

Hit Control+'X', press 'Y' and return to save the changes to the file.


• You can now launch Postfix with:

sudo postfix start

• Restart PostFix with this command:

sudo postfix reload

• To force deliveries to start:

sudo postfix flush

When you restart, Postfix will be active. To use that mailserver, just set your email client's outgoing mailserver to "localhost" or "127.0.0.1".

You can verity the server is running by using telnet to connect to port 25 (SMTP): for example..

telnet localhost 25


Checking if Postfix is running with "telnet localhost 25" command

If your connection fails, you need to verify that you have a DNS hostname for your computer and check for error messages in the /var/log/mail.log file. The Postfix messages are quite verbose and a great deal of help with debuggin a faulty installation.

Try sending yourself a test message from a remote computer, Be sure to specify the destination as the hostname and username used on your Mac OS X machine.


3.- Troubleshooting

Postfix can cause the startup process to hang. By making a minor modification to the startup script, you can eliminate this hang. To do so, open the Terminal and type "sudo pico /System/Library/StartupItems/Postfix/postfix". Add an ampersand (&) after the line with the Postfix command.

4.- Restarting Postfix

You can restart Postfix writing the following (in the Terminal):

sudo postfix reload

5.- How to set MaxBulk Mailer to use Postfix?

It is as easy as setting the SMTP host to "localhost" or "127.0.0.1" (Set 'Account ID' to whatever you like)


In order to use Postfix just set the SMTP host to "localhost" or "127.0.0.1"

At this point, you are ready to send e-mails as fast as hell bypassing your local ISP SMTP server and delivering all your e-mails directly to each recipient mailbox.

[ Reply to This ]

10.3: Enable the postfix Mail Transfer Agent

Authored by: burble on Sat, Mar 6 '04 at 12:23PM

In the version of main.cf that I have on my system apple have 'kindly' added a set of defaults at the bottom of the file. These over-write the 'inet_interfaces' and 'mynetworks_style' values and set them to prevent remote connections. It's worth checking thay if you set any variables that they're not reset within the file at a later point.

You can check the actual running config with sudo postconf -n, which is useful for debugging purposes. Also it's sometimes worthwhile doing a sudo postfix stop followed by a sudo postfix start rather than a sudo postfix reload. A reload doesn't always seem to fix everything.

[ Reply to This ]

Important: Correct Hostnames

Authored by: jasenko on Thu, Mar 18 '04 at 10:01PM

The most important thing is to use valid hostnames in main.cf, in most cases, mailservers on the other side will reject your messages if it can't reach the hostname. Here is how it works:
You added

myhostname = notvalidhost.com

When you send a message myhostname is added to your username and it looks like this

username@notvalidhost.com

Receiving server checks notvalidhostname.com and returns a message that notvalidhostname.com is unroutable.

I think any valid hostname will work. I use my own, set up at dyndns.org and postfix works without a problem for sending emails via Internet. Using this method can affect local mail delivery though.

[ Reply to This ]

10.3: Enable the postfix Mail Transfer Agent

Authored by: Krazy on Fri, Apr 30 '04 at 02:59AM

Having problems with the mailbox size on your local machine? By default its set to around 50Mb. When you exceed this mail wont be delivered, and you will see messages in mail.log like:

Apr 30 18:42:37 myMac postfix/local[2456]: 47E237DF92: to=, relay=local, delay=0, status=bounced (cannot access mailbox /var/mail/foo for user foo. error writing message: File too large)

The solution:
sudo postconf -e "mailbox_size_limit = NEW_SIZE"
sudo SystemStarter restart "SMTP"
replace NEW_SIZE above with the size you want. 204800000 gives you 200Mb.

[ Reply to This ]
10.3: Enable the postfix Mail Transfer Agent - Authored by: ugofonzar on Thu, Jul 29 '04 at 05:48PM
to send files more than 10 MB with localhost - Authored by: ugofonzar on Mon, Aug 2 '04 at 04:07PM

It's easier than this hint says

Authored by: davidmorr on Thu, May 20 '04 at 01:05AM

Open up /etc/postfix/main.cf, and edit these lines to reflect your setup. These are examples from my setup; yours might be different.
• LINE 67: myhostname = stibnite.oeyvind.org
• LINE 75: mydomain = oeyvind.org
• LINE 91: myorigin = $mydomain
• LINE 105: inet_interfaces = all
• LINE 152: mydestination = $myhostname, localhost.$mydomain
• LINE 239: mynetworks_style = subnet
• LINE 253: mynetworks = 192.168.0.0/23, 127.0.0.0/8
Save your work, and exit the file.
If your Mac is properly configured (ie, you provided host name and domain when you installed Panther), you do not need to change any of these values to get postfix to work. In every case, what has been changed here is exactly the default postfix will use if you do not change them.

The only thing you do have to change in main.cf is the lines:
# THE FOLLOWING DEFAULTS ARE SET BY APPLE
#
# bind to localhost only
#
inet_interfaces = localhost

# turn off relaying for local subnet
#
mynetworks_style = host
Comment out both of these lines by inserting a # in column 1 to prevent them overriding the values defined earlier in the file.

Stop and start postfix and you are in business.

David

Posted: Thu - March 10, 2005 at 06:28 PM        


©