Setting up postfix on Ubuntu for mailing from PHP

To allow your Ubuntu server to send emails from PHP, then you need to install postfix. Postfix is a mailer for *nix platforms.

So, to install it:

sudo apt-get install postfix

When this is installing, you’ll need to enter some options, like what sort of server you’re connecting to. I use my companies details in here, and this means I need to enter the domain into the origins so that we don’t get refused mail.

sudo nano /etc/postfix/main.cf

Un-comment the line that states myorigin = /etc/mailname

Also, I have to enter the ip address of my mail server in the relayhost section.

CTRL X and save the file.

Now, we need to create the file /etc/mailname

sudo nano /etc/mailname

In this empty file, enter the domain name for your mailserver.

christatedavies.co.uk

CTRL X and save the file.

Now, just restart postfix:

sudo /etc/init.d/postfix restart

Job’s a goodun.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.