Raspberry Pi Email Server Part 1: Postfix

Postfix Logo

This is the first part of a five part tutorial that will show you how to install a full featured email server on your Raspberry Pi. This tutorial covers Postfix, the Mail Transfer Agent.

The parts are:
The Introduction & Contents Page (read first)
Raspberry Pi Email Server Part 1: Postfix
Raspberry Pi Email Server Part 2: Dovecot
Raspberry Pi Email Server Part 3: Squirrelmail
Raspberry Pi Email Server Part 4: Spam Detection with Spamassassin
Raspberry Pi Email Server Part 5: Spam Sorting with LMTP & Sieve

Installing Postfix

Note: While you are setting up the mail server on the Pi, it’s a good idea to turn off port forwarding rules for email to the Pi in your router’s firewall. If you don’t have any port forwarding rules now, that’s great, don’t worry – I’ll prompt you to set them up later.

First, log into your Pi with a SSH session and install postfix:

sudo apt-get update
sudo apt-get install postfix

You will see a menu with some choices. Select “Internet Site” and then set the mail name to your domain name, not including www. (e.g. samhobbs.co.uk).

The setup script will then do some automatic configuration for you. The output will look something like this:

Selecting previously unselected package postfix.                                              
(Reading database ... 67653 files and directories currently installed.)                       
Unpacking postfix (from .../postfix_2.9.6-2_armhf.deb) ...                                    
Processing triggers for man-db ...
Setting up postfix (2.9.6-2) ...
Adding group `postfix' (GID XXX) ...
Done.
Adding system user `postfix' (UID XXX) ...
Adding new user `postfix' (UID XXX) with group `postfix' ...
Not creating home directory `/var/spool/postfix'.
Creating /etc/postfix/dynamicmaps.cf
Adding tcp map entry to /etc/postfix/dynamicmaps.cf
Adding sqlite map entry to /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (GID XXX) ...
Done.
setting myhostname: samhobbs
setting alias maps
setting alias database
changing /etc/mailname to samhobbs.co.uk
setting myorigin
setting destinations: samhobbs.co.uk, samhobbs, localhost.localdomain, localhost
setting relayhost: 
setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
setting mailbox_size_limit: 0
setting recipient_delimiter: +
setting inet_interfaces: all
/etc/aliases does not exist, creating it.
WARNING: /etc/aliases exists, but does not have a root alias.

You can edit all of this later.

You may also get some warnings like this:

postmulti: warning: inet_protocols: disabling IPv6 name/address support: Address family not supported by protocol

IPv6 is a new type of IP address that was introduced because we’re running out of the “old” IPv4 addresses. Not many ISPs support IPv6 yet, so you probably don’t need it. Unless you fix the warning, you’ll see it every time.

Change directory into the postfix configuration folder:

cd /etc/postfix/

Edit /etc/postfix/main.cf with your favourite command line text editor (e.g. sudo nano main.cf) and add inet_protocols = ipv4 to the end of the file.

Now is also a good time to check that your hostname is specified properly in /etc/postfix/main.cf. The setup script takes the hostname of the server and uses that, but it may not be in the right format, i.e. “samhobbs” instead of “samhobbs.co.uk”. Find the line that begins myhostname = and make sure it is your fully qualified domain name. This is important because your server will use this to talk to other mail servers, and some will reject your emails if you don’t use a fully qualified domain name to say hi! This is covered in more detail in the helo access restrictions later.

Restart postfix and you shouldn’t see the warnings any more:

sudo service postfix restart

Testing and Configuration

Before you start, it’s probably worth backing up the configuration files in their current state. This way, you’ll have something to compare to if you’re ever trying to work out which bits were defaults and which bits you changed yourself:

cd /etc/postfix
sudo cp main.cf main.cf.BAK
sudo cp master.cf master.cf.BAK

Mailbox Setup

There are a couple of different types of mailbox you can use, I’ve chosen to use a “Maildir” rather than “mbox” configuration. For users with “real” UNIX accounts on the system (like the one you’re using to log in), Maildir creates a folder in the user’s home directory and places emails inside it, one file for each email.

I prefer this to the alternatives, because it’s easier to see and understand: you can rummage around in your home folder and see all your emails as individual files.

To tell Postfix to use the Maildir format, add the following lines to /etc/postfix/main.cf:

home_mailbox = Maildir/
mailbox_command =

If there's already a line with mailbox_command, comment it out by adding a # at the start of the line.

We also need to create the mail directory and its subfolders for existing users, and add some things to /etc/skel (the template for new users) so that if you create a new account this will be done automatically.

These commands are part of Dovecot, so first we need to install it:

sudo apt-get update
sudo apt-get install dovecot-common dovecot-imapd

You will get a lot of output: some other dovecot packages will automatically be installed and the config files will be created. You will also see some errors – don’t worry about those for now, I’ll explain how to deal with them in part 2, later.

Now we can create those mail folders. Run the following commands to create the template files:

sudo maildirmake.dovecot /etc/skel/Maildir
sudo maildirmake.dovecot /etc/skel/Maildir/.Drafts
sudo maildirmake.dovecot /etc/skel/Maildir/.Sent
sudo maildirmake.dovecot /etc/skel/Maildir/.Spam
sudo maildirmake.dovecot /etc/skel/Maildir/.Trash
sudo maildirmake.dovecot /etc/skel/Maildir/.Templates

Next, copy the files over to existing users’ home directories, and change the ownership and permissions for privacy (replace USER with the username you are doing this for, and repeat for all existing usernames):

sudo cp -r /etc/skel/Maildir /home/USER/
sudo chown -R USER:USER /home/USER/Maildir
sudo chmod -R 700 /home/USER/Maildir

Initial Testing

Now, the best way to test Postfix during configuration is to use Telnet, because it is such a simple way of communicating between programs and there’s less to go wrong and get confused about.

First, install telnet:

sudo apt-get install telnet

Now, still inside the SSH session to your pi, type this command. It will connect you to port 25 on the Pi:

telnet localhost 25

You can now test sending an email using SMTP. Here are the steps:

  1. send an ehlo command to tell the server who you are, and it will tell you its capabilities
  2. use the mail from command to say who the email is from. If you are sending it from an address that exists on the server, you needn’t include the domain name (i.e. user instead of user@yourdomain.com)
  3. use the rcpt to command to tell the server where to send the email
  4. Use the data command to tell the server that you’re about to start giving it the message you want to send
  5. Type Subject: YOUR SUBJECT then enter to set a subject
  6. Type the body of your email. Once you’re done, press ENTER, then ., then ENTER again.
  7. Type quit to exit

Here’s an example:

telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 samhobbs.co.uk ESMTP Postfix (Debian/GNU)
ehlo foobar
250-samhobbs.co.uk
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: me        
250 2.1.0 Ok
rcpt to: me@outsideemail.com
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject: test
This is a test email
.
250 2.0.0 Ok: queued as A639C3EE6D
quit 
221 2.0.0 Bye

Some Access Restrictions

Add the following to /etc/postfix/main.cf to restrict who can send emails to external mail servers:

smtpd_recipient_restrictions =
        permit_sasl_authenticated,
        permit_mynetworks,
        reject_unauth_destination

Reload postfix:

sudo service postfix reload
  • Line 1 begins the list of restrictions.
  • Line 2 permits users who have authenticated with Simple Authentication and Security Layer (SASL) to send email to any destination (this is part of the Dovecot config in Part 2, later).
  • Line 3 will let users send emails to any destination if they have connected from an IP address defined in mynetworks.
  • Line 4 will reject the email if none of the above conditions have been met unless the “rcpt to” address is one of the addresses that your server is accepting email to (as defined in main.cf with the mydestination parameter).

In its present state, the email server will allow you to send external emails because the connection is originating from the Pi itself (you are logged in via SSH) and not an unknown computer. Addresses of “trusted” computers are listed under the mynetworks setting in main.cf, e.g.

mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

Try sending an external email again, using telnet as before. You should be able to do so without any issues.

Now we want to see what kind of response someone would get if they were connecting from outside of the IP range defined in mynetworks, to make sure Pi won’t allow everyone to send outgoing emails from your server. To simulate this we can comment out permit_mynetworks under smtpd_recipient_restrictions:

smtpd_recipient_restrictions =
        permit_sasl_authenticated,
#       permit_mynetworks,
        reject_unauth_destination

Now reload the postfix configuration:

sudo service postfix reload

This will let you see what kind of response you would get if you weren’t sending the email from mynetworks. Try sending again, and you should receive an error “554: Relay access denied“:

admin@samhobbs /etc/postfix $ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 samhobbs.co.uk ESMTP Postfix (Debian/GNU)
ehlo samhobbs.co.uk
250-samhobbs
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: USER
250 2.1.0 Ok
rcpt to: me@externalemail.com
554 5.7.1 <me@externalemail.com>: Relay access denied
quit
221 2.0.0 Bye
Connection closed by foreign host.

Perfect. Leave permit_mynetworks commented out in your smtpd_recipient_restrictions (you'll see why in part 2).

Helo access restrictions

Helo access restrictions can be a very useful way of blocking spam.

Note that we’re not talking about unauthorised people being able to send email outside your network any more (that’s taken care of with the smtpd_recipient_restrictions); we’re now talking about stopping spammers from sending incoming mail to your email address.

Spammers try to conceal their identity so that they don’t end up on block lists, so they rarely use helo hostnames that could identify them – these hostnames are written to the mail log files. As a result, they often make up a random string or use an IP address instead of a domain name.

Luckily, these are easily taken care of.

Add the following to /etc/postfix/main.cf:

smtpd_helo_required = yes
smtpd_helo_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated,
        reject_invalid_helo_hostname,
        reject_non_fqdn_helo_hostname,
        reject_unknown_helo_hostname
  • Line 1 requires people and programs to identify themselves when they send email, using the helo or ehlo commands I mentioned earlier.
  • Line 2 starts the list of restrictions.
  • Line 3 accepts any old rubbish in the ehlo if it comes from an IP address defined in mynetworks. If the connection isn’t connecting from an IP address in mynetworks, then the helo hostname is checked against the rest of the list.
  • Line 4 accepts any helo hostname if the client is authenticated with SASL (I added this to the tutorial recently after troubleshooting problems some people had in the comments – it allows you to connect from any network and still send messages through your Pi. Mobiles will usually work without this because most providers pass mail through their own proxies, so your Pi receives a connection from the proxy – which has a valid hostname – and not from the mobile, which may be called something like “android-b627cfe2efea7e67″).
  • Line 5 rejects connection attempts when the HELO hostname syntax is invalid.
  • Line 6 rejects non-fully qualified domain names (for example, foobar instead of foobar.com). This will also block those random strings, e.g. “kjhrsbvks”.
  • Line 7 rejects the helo hostname if it that domain doesn’t have a valid DNS A or MX record. For example, someone spamming you could make up a domain like theflyingspaghettimonster.com. If that domain doesn’t actually exist and have the right records, then your server won’t accept it as a hostname, and the email will be rejected.

If the helo hostname gets past line 7 and hasn’t been denied, it is accepted. You’d be surprised how much spam these helo access restrictions will block on their own (looking through my log files, I can see numerous spam scripts that have attempted to ehlo with my IP address), but there’s an extra step we can add in here to help:

Blocking people claiming to be your domain name

Many spammers try to send email to you after helo’ing with your own domain name. Since postfix doesn’t check whether or not they’re lying about their helo hostname, this will usually work.

But, since we’ve put permit_mynetworks at the top of the list, anyone actually sending an email from your domain will be accepted already. Anyone using your hostname who isn’t in mynetworks is an imposter.

So, add one more line to the end of the restrictions list:

smtpd_helo_restrictions =
        permit_mynetworks,
        permit_sasl_authenticated,
        reject_invalid_helo_hostname,
        reject_non_fqdn_helo_hostname,
        reject_unknown_helo_hostname,
        check_helo_access hash:/etc/postfix/helo_access

That last line checks a file for custom rules you’ve built in. Create the file:

sudo nano /etc/postfix/helo_access

Add the following lines, edited for your domain:

samhobbs.co.uk          REJECT          Get lost - you're lying about who you are
mail.samhobbs.co.uk      REJECT          Get lost - you're lying about who you are

Now tell postfix to map the file, and restart postfix:

sudo postmap /etc/postfix/helo_access
sudo service postfix restart

Now anyone who tries to ehlo with one of the hostnames you defined in that file gets rejected, and sees the “get lost” message. Your legitimate servers won’t have that problem, because they will already have been accepted higher up the list.

Neat, right? I found that little nugget of wisdom at unixwiz.net.

Moving on…

We’re almost done with Postfix now, athough there are a few bits of configuration that we’ll want to do once we’ve set up SASL with Dovecot, which I’ve chosen to lump in with the Dovecot tutorial.

In Raspberry Pi Email Server Part 2: Dovecot, we’ll set up Dovecot to provide SASL authentication and IMAP capability.

Please leave a comment if you’re having trouble with anything in this tutorial, and I’ll try and help you out!

Type: 

Comments

Hello,
Thanks 4 your tut.Everything works just fine only I don't get root mail anymore cause I blocked it to somehow. My logs say: warning: host example[127.0.1.1]:25 greeted me with my own hostname example.com
warning: host example[127.0.1.1]:25 replied to HELO/EHLO with my own hostname example.com
Please help me, how can I get root mail again?

If it was working, and you changed it, and now it doesn't work, what did you change?

I wouldn't expect to see that warning, have you messed with the mydestination parameter? I don't think it's related to the root mail thing though.

Sam

I didnt change anything (on purpose) but I restored an earlier version of my sd card. All I know what's different now is that I had to change the etc/aliases file. Before it worked with myname: myname but after the crash I only get it working again after I changed it to myname: myname@mywebsite.com. I thought I had it fixed until I found out I'm missing root mail.

Hmm. If you change /etc/aliases, you need to run sudo newaliases afterwards, did you do that?

When did you take the last image, was it after you set everything up and it was all working?

Sam

Jan 3 07:54:43 raspberrypi postfix/cleanup[1679]: 57E8E1600DB: message-id=<20170103075443.57E8E1600DB@pranavgupta.dynu.com>
Jan 3 07:54:43 raspberrypi postfix/bounce[1685]: 6B7831600D2: sender non-delivery notification: 57E8E1600DB
Jan 3 07:54:43 raspberrypi postfix/qmgr[29654]: 57E8E1600DB: from=<>, size=2945, nrcpt=1 (queue active)
Jan 3 07:54:43 raspberrypi postfix/qmgr[29654]: 6B7831600D2: removed
Jan 3 07:54:43 raspberrypi postfix/local[1687]: 57E8E1600DB: to=, relay=local, delay=0.16, delays=0.07/0.02/0/0.07, dsn=5.1.1, status=bounced (unknown user: "cyborg")
Jan 3 07:54:43 raspberrypi postfix/qmgr[29654]: 57E8E1600DB: removed
Jan 3 07:54:46 raspberrypi postfix/smtpd[1650]: disconnect from localhost[::1]
Jan 3 08:02:03 raspberrypi postfix/master[29652]: terminating on signal 15
Jan 3 08:02:04 raspberrypi postfix/master[1911]: daemon started -- version 2.11.3, configuration /etc/postfix
Jan 3 08:02:19 raspberrypi postfix/smtpd[1934]: connect from localhost[::1]
Jan 3 08:02:43 raspberrypi postfix/smtpd[1934]: lost connection after CONNECT from localhost[::1]
Jan 3 08:02:43 raspberrypi postfix/smtpd[1934]: disconnect from localhost[::1]
Jan 3 08:05:14 raspberrypi postfix/smtpd[1989]: connect from localhost[::1]
Jan 3 08:05:34 raspberrypi postfix/smtpd[1989]: disconnect from localhost[::1]
Jan 3 08:08:30 raspberrypi postfix/smtpd[2035]: connect from localhost[::1]
Jan 3 08:10:25 raspberrypi postfix/smtpd[2035]: 182161600D2: client=localhost[::1]
Jan 3 08:11:12 raspberrypi postfix/cleanup[2110]: 182161600D2: message-id=<20170103081025.182161600D2@pranavgupta.dynu.com>
Jan 3 08:11:12 raspberrypi postfix/qmgr[1918]: 182161600D2: from=, size=351, nrcpt=1 (queue active)
Jan 3 08:11:14 raspberrypi postfix/smtp[2124]: connect to gmail-smtp-in.l.google.com[2404:6800:4003:c02::1a]:25: Network is unreachable
Jan 3 08:11:17 raspberrypi postfix/smtp[2124]: 182161600D2: to=, relay=gmail-smtp-in.l.google.com[74.125.68.27]:25, delay=78, delays=73/0.03/3.7/1.4, dsn=5.7.1, status=bounced (host gmail-smtp-in.l.google.com[74.125.68.27] said: 550-5.7.1 [117.212.113.77] The IP you're using to send mail is not authorized to 550-5.7.1 send email directly to our servers. Please use the SMTP relay at your 550-5.7.1 service provider instead. Learn more at 550 5.7.1 https://support.google.com/mail/?p=NotAuthorizedError u62si45203206pgd.227 - gsmtp (in reply to end of DATA command))
Jan 3 08:11:17 raspberrypi postfix/cleanup[2110]: A3E771600DB: message-id=<20170103081117.A3E771600DB@pranavgupta.dynu.com>
Jan 3 08:11:17 raspberrypi postfix/qmgr[1918]: A3E771600DB: from=<>, size=2933, nrcpt=1 (queue active)
Jan 3 08:11:17 raspberrypi postfix/bounce[2125]: 182161600D2: sender non-delivery notification: A3E771600DB
Jan 3 08:11:17 raspberrypi postfix/qmgr[1918]: 182161600D2: removed
Jan 3 08:11:17 raspberrypi postfix/local[2126]: A3E771600DB: to=, relay=local, delay=0.16, delays=0.06/0.03/0/0.07, dsn=2.0.0, status=sent (delivered to maildir)
Jan 3 08:11:17 raspberrypi postfix/qmgr[1918]: A3E771600DB: removed
Jan 3 08:14:55 raspberrypi postfix/smtpd[2035]: disconnect from localhost[::1]

Hello Sam,
so I've rbeen following your tutorial and i encountered two problems.
1). It won't connect to my localhost so I have to connected to my domain ( Wich is the same since my pi hosts the domain.)

diego@hernandezherrera:~ $ telnet localhost 25
Trying ::1...
telnet: Unable to connect to remote host: Connection refused

2). Telnet won't send my emails .

diego@hernandezherrera:~ $ telnet hernandezherrera.mx 25
Trying 127.0.1.1...
Connected to hernandezherrera.mx.
Escape character is '^]'.
220 hernandezherrera.mx ESMTP Postfix (Raspbian)
ehlo pi
250-hernandezherrera.mx
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: pi@hernandezherrera.mx
250 2.1.0 Ok
rcpt to: diego@hernandezherrera.mx
250 2.1.5 Ok
data
354 End data with .
Subject: test
This is a test mail.
.
250 2.0.0 Ok: queued as 42460128E
quit
221 2.0.0 Bye
Connection closed by foreign host.

I'd appreciate any help,
thanks,
Diego.

P.S: diego@hernandezherrera.mx is hosted by www.1and1.mx wich is where I registered my domain, it isn't hosted in my pi.

Are you running the telnet command on/from the pi? You are connecting to localhost, which is the local machine (so if you ran the telnet command from on your laptop you wouldn't be connecting to the pi).

The other thing that could mess it up is if you've modified your /etc/hosts file and localhost no longer routes to 127.0.0.1.

If it's neither of those, postfix may not be running on your pi (sudo service postfix status).

Don't telnet to your domain name, because that will connect you to the 1and1 email server. You should note that if you want the pi to handle email for your domain, you will need to change your MX records so that they no longer point to 1and1's email server and point to your pi's global IP address instead (see the DNS basics tutorial).

Sam

Hi! First, thanks a lot for the tutorial and sorry for my bad English.

I follow the tutorial, I can send email to outside (to my Gmail account), but when I try to reply (or write a new email), Gmail say: The recipient server did not accept our requests to connect.

I don't have idea what is wrong.

Thanks!

Yes, I am using noip (like hostname.no-ip.org) because it's free. The port 25 is open, and I redirect to my Raspberry Pi.

Hi Sam,

Thanks for this write up and the help.
I am running into this error about "nested MAIL command" after entering mail to: email...

220 raspberrypi.all1tech.com ESMTP Postfix (Raspbian)
ehlo fooBar
250-raspberrypi.all1tech.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from: john@all1tech.com
250 2.1.0 Ok
mail to: john@all1tech.com
503 5.5.1 Error: nested MAIL command

I have tried directly from the pi as well as via remote ssh session.
also tried with various diff email address' but always getting this same err.

Any ideas?

Thanks,
-john

postmap: warning: /etc/postfix/main.cf, line 61: overriding earlier entry: smtpd_helo_restrictions=permit_mynetworks, permit_sasl_authenticated, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_helo_hostname

how can i fix this?

smtpd_helo_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_invalid_helo_hostname,
reject_non_fqdn_helo_hostname,
reject_unknown_helo_hostname,
check_helo_access hash:/etc/postfix/helo_access
this is the last portion wich i pasted into the sudo postmap /etc/postfix/helo_access

this is how the complete portion looks :
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = dannyunlocks.nl
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = dannyunlocks.nl, raspberrypi, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
home_mailbox = Maildir/
mailbox_command =
smtpd_recipient_restrictions =
permit_sasl_authenticated,
# permit_mynetworks,
reject_unauth_destination
smtpd_helo_required = yes
smtpd_helo_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_invalid_helo_hostname,
reject_non_fqdn_helo_hostname,
reject_unknown_helo_hostname
smtpd_helo_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_invalid_helo_hostname,
reject_non_fqdn_helo_hostname,
reject_unknown_helo_hostname,
check_helo_access hash:/etc/postfix/helo_access

/etc/postfix/helo_access should contain something like this (edited for your domain), not the configuration from main.cf...

yourdomain.com          REJECT          Get lost - you're lying about who you are
yourdomain.com      REJECT          Get lost - you're lying about who you are

Sam

I have put this in /etc/postfix/helo_access

dannyunlocks.nl REJECT Get lost - you're lying about who you are
mail.dannyunlocks.nl REJECT Get lost - you're lying about who you are

but stil get this:
root@raspberrypi:/home/pi# sudo postmap /etc/postfix/helo_access
postmap: warning: /etc/postfix/main.cf, line 61: overriding earlier entry: smtpd_helo_restrictions=permit_mynetworks, permit_sasl_authenticated, reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_helo_hostname

So you said "Leave permit_mynetworks commented" in the recipient restrictions and that we'll see why.

You never explained why!

Should it be commented or uncommented? WHy even add it to the recipient restrictions to just comment it?

Ben,

I implied the answer without explicitly saying it...

"For testing, the permit_mynetworks parameter should be commented out under your postfix smtpd_recipient_restrictions block in /etc/postfix/main.cf. If you’re following on from Raspberry Pi Email Server Part 1: Postfix then this should already be the case. If you have to change it, remember to reload postfix (sudo service postfix reload) after you change the value."

If you don't comment out permit_mynetworks and you are testing from within whatever you have defined as your network (which certainly includes localhost, possibly your whole LAN), your test email will bypass the rest of the restrictions further down the list.

You'll notice that at the end of that testing section I ask you to uncomment it again so that is in effect later on - it allows programs running on your server (like squirrelmail) to send email without being subject to the rest of the restrictions in the list.

Sam

Hi I am using Opensuse Server those file on the Tutorials I am having problems to copy then (sudo: maildirmake.dovecot: command not found) this is the info i am getting. I think you are doing a good job.

Thank you very much, great tutorial !!!

trying to set up postfix i get this error when i open mutt
var/mail/soydepr: No such file or directory (errno = 2)

also i have no mail after testing telnet localhost 25 log does show this

Mar 16 22:28:09 coqui postfix/smtpd[12357]: connect from localhost[127.0.0.1]
Mar 16 22:29:02 coqui postfix/smtpd[12357]: 9388083EED: client=localhost[127.0.0.1]
Mar 16 22:29:18 coqui postfix/cleanup[12360]: 9388083EED: message-id=<20170317022902.9388083EED@coqui>
Mar 16 22:29:18 coqui postfix/qmgr[12003]: 9388083EED: from=<****@coqui>, size=299, nrcpt=1 (queue active)
Mar 16 22:29:18 coqui postfix/local[12379]: 9388083EED: to=<*****r@coqui>, relay=local, delay=41, delays=41/0.03/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Mar 16 22:29:18 coqui postfix/qmgr[12003]: 9388083EED: removed
Mar 16 22:29:21 coqui postfix/smtpd[12357]: disconnect from localhost[127.0.0.1]

what email client you were using in this original set up

The tutorial covers Thunderbird (basically because it's cross-platform) but I actually use Kmail at home.

Sam

Pages

Add new comment