Tutorial – Install Postfix to allow outgoing email on Raspberry Pi

So far, I’ve covered overclocking your Raspberry Pi, preparing to run your Raspberry Pi as a web server, installing Apache, PHP and MySQL and installing PhpMyAdmin. I’m assuming you’ve at least set your hostname and installed Apache, PHP and MySQL on your Raspberry Pi for this tutorial.

Before we go ahead and install WordPress, we need to ensure that outgoing email can be sent from your Raspberry Pi. In this tutorial, I’ll cover installing Postfix, which is a mail transport agent.

Step 1 – Make sure you’re up-to-date

To begin, run the following command to make sure you’re running the latest software updates:

sudo apt-get update

Any updates available will be downloaded and installed.

Step 2 – Begin the Postfix Installation

Once done, go ahead and enter this command to get the ball rolling:

sudo apt-get install postfix

The postfix setup will now start. You will see a blue screen with some information on the various configuration types, arrow down to ‘ok’ to continue.

Next you will be given the options available. Choose ‘internet site‘ from the list:

Once you’ve chosen this, go to ‘ok‘ to continue.

Step 3 – Configure your Postfix FQDN

The final step is to configure the FQDN. It is important that you’ve already set the hostname (see my tutorial which includes this) as we’re asked to confirm it at this stage.

Set the system mail name to your fully qualified domain name. For example, my Raspberry Pi uses the FQDN ‘dingleberrypi.com’, so I entered dingleberrypi.com here:

Once you’ve entered this, double check it and the go to ok. That’s it, you’re ready to rock and roll! You’ll now be able to receive mail from your Raspberry Pi web server!

Ste

Web Developer living in Manchester, working for Studio Skylab (http://www.studioskylab.com). Views and thoughts are my own.

You may also like...

14 Responses

  1. Nathan says:

    I am setting up a wordpress server on my raspberry pi and I cannot seem to get mail working. I have tried sending mail to several account and have also re-installed all the software on my pi twice. Any Ideas? Also what ports do you have open?
    Thanks
    Nathan

    • Ernie Marsh says:

      I installed a WordPress blog on my Pi and it installed and works great for playing around.
      What I use for mail is a WP-plugin called Configure SMTP. It is simple to configure and works for me.

  2. jake says:

    Hey I am so glad you made these tutorial, so much help!!!
    But, you might want to include apt-get upgrade so the new updated packages get installed.
    I hope I have not been stressing your Pi by coming by so often 😛

  3. Cliff says:

    An excellent website. I’ve spent hours searching for this information, and since finding this website my progress has been rapid.
    I’ve got my wordpress up and running on my raspberrypi,

    http://www.cliffpackman.com

    Forever indebted for your skills,
    Thanks,
    Cliff

  4. adr01 says:

    I *think* this magically fixed my PHP email not working for actual websites. (PHP scripts in the OS did work though :s)

    Thanks!

  5. Beans1233 says:

    Hey, great website, followed this to get my pi running a webserver. Running php5, apache2 and phpmyadmin as well as all the other mysql stuff…
    I wanted to send emails, automatically, through php scripts… but the mail() function never works, and I’ve tried so many different mailing servers and systems… I hoped this would work seems as it’s on the same tutorial that I built the rest from…
    I dunno where to start as to why it doesn’t work… is there any changes I need to make to the php.ini in apache2 to make it work?

    Any help with this would be much appreciated!

    😀

  6. I have a registered domain (example.com). My hostname for the pi is example. should I change the hostname to example.com instead of example? Should I do the same with the system mail name on PostFix? Thanks.

  7. dhaval patel says:

    photo show after shaving

  8. dhaval patel says:

    php scripts on a.i. windows8.1

  1. 24th February 2013

    […] Ste W So far, I’ve covered overclocking your Raspberry Pi, preparing to run your Raspberry Pi as a web […]

  2. 5th January 2017

Leave a Reply