Raspberry Pi Email Server

raspberry-pi-email-server.png

The RasPi’s small size and low power consumption make it an ideal choice for use as a home email server. After trying a couple of different pieces of software, I finally found an excellent combination: Postfix with Dovecot and Squirrelmail, plus Spamasssassin and Sieve for spam filtering.

There are many, many tutorials out there for the first trilogy of programs, but since the configuration is slightly different for each distribution I kept coming unstuck when setting mine up on the Pi. Having finally got mine configured properly, I’ve put together a set of 5 tutorials, which will take you from a vanilla Raspbian image to a fully functioning email server in no time.

When writing the tutorial I made an effort to explain what each setting does instead of just dumping commands. With a bit of luck at the end of the process you’ll not only have a working server, you’ll understand how it works… without having to wade through reams of documentation like I did!

If you follow the tutorials from start to finish, here’s what you’ll end up with:

  1. An email server that you can run 24/7/365 for under £5 of electricity per year
  2. Personalised email address like you@yourdomain.com (requires you to have registered a domain name with a registrar like namecheap.com - see my DNS basics tutorial)
  3. The ability to connect from anywhere, and read & send email, using a secure IMAP connection on your phone, tablet or computer
  4. Log in to webmail using any web browser on a secure HTTPS connection, read & send email
  5. Complete control over your personal communication. Your emails are stored on YOUR server, and nobody is scanning them to sell you adverts.
  6. Smart spam filtering with Spamassassin
  7. Customisable mail sorting with Sieve rules

Postfix, the Mail Transfer Agent

Postfix Logo
Postfix is the program that lets you send and receive email using Simple Mail Transfer Protocol (SMTP). Whilst you, the user, may connect to your email server using IMAP (on port 143 or 993), or POP (on port 110 or 995), email servers talk to each other using SMTP on port 25.

So, this is the basic core of the server. Without it, you wouldn’t be able to send or receive any emails!

I’ve covered the setup here:
Raspberry Pi Email Server Part 1: Postfix

Dovecot, the POP/IMAP Server

dovecotLogo-300x130_0.png
Dovecot is used for two things:

  1. It provides you with IMAP functionality
  2. It checks that you are who you say you are using Simple Authentication and Security Layer (SASL) before you send or fetch mail

If you’re not interested in connecting with IMAP on your devices, you still need Dovecot. Not only is it doing SASL for you, but Squirrelmail connects using IMAP in order to provide you with webmail.

I’ve covered Dovecot installation and configuration here:
Raspberry Pi Email Server Part 2: Dovecot

Squirrelmail, for Webmail

Squirrelmail Logo
Squirrelmail is handy because it allows you to check your email in any browser, from anywhere.

Of the first three, it’s probably the easiest to configure. I’ve covered it here:
Raspberry Pi Email Server Part 3: Squirrelmail

Spamassassin, for Marking Spam

Spamassassin Logo
Spamassassin is the program that we will use to audit incoming mail and decide whether or not it’s spam. Spamassassin doesn’t actually sort the mail into the spam folder, it only changes information in the headers based on the results of the scan. I’ve covered it here: Raspberry Pi Email Server Part 4: Spam Detection with Spamassassin.

LMTP & Sieve for Spam Sorting & Mailbox Organisation

After Spamassassin has checked incoming mail to see if it’s spam or not, we need another program to sort it into the right mail folder. This final step will be done with Dovecot’s Local Mail Transfer Protocol (LMTP) daemon and a Sieve plugin.

Sieve is a simple programming language that allows users to define what to do with incoming email based on a predefined set of rules – think “if the header contains this flag, put it in the spam folder” kind of thing and you’ll get the gist. Aside from spam filtering, Sieve can be used to automatically sort & de-clutter your inbox. These steps are covered in the final tutorial: Raspberry Pi Email Server Part 5: Spam Sorting with LMTP & Sieve

Enjoy! I’d love to hear how you get on, so leave a comment below :)

Type: 

Comments

Dynamic DNS is working, I am using dyndns and checked that the my actual ip and the one they have are the same. Also, I have the dyndns health check on and if the server goes off line it dyndns notifies me that the server has gone off line and when it comes back up. My router has a function for logging onto dyndns. As I said, my website is up and running fine and I can send emails via my RPi, but can't receive.

Yes but you said your MX record was deleted, which must have been either your dynamic DNS client, you (manually), or your DNS provider (in error or on purpose).

The lack of MX record is the reason you can't receive, so we need to work out why/how it was deleted.

To answer your question directly, you can ping an IP address with the ping command, but what you should really do to make sure your server is at that address is the openssl tests - any machine can return a ping, but only yours has your key+certificate. That's beside the point though, you need to recreate the MX record.

Sam

Thanks Sam, I now have acquired a static-ip address to see if that is the issue, and I am following instructions from DynDNS, but I am struggling to see how one creates an MX record in the DynDNS site. Is that what I should be doing? Do you have any tutorials or sites you would recommend I look at?
Cheers
George

Cool, that should cut down on any problems you were having.

Do you have your own domain name or are you using a dyndns subdomain? If you have your own domain, you shouldn't need to use dyndns at all, just create an MX record on the site of whoever you registered the domain with. If you don't have your own domain, consider registering one, it's not expensive (see namecheap.com ). I've never used dyndns so I don't know how their site works.

Check out my DNS tutorial for MX record creation with namecheap and more info about DNS records for email servers.

Sam

Hi Sam,

Just finished part 3 of your tutorial without any big problems. So thank you for that it all works fine. Starting part 4 and 5 in 2016;).

Regards,

Ronald

Hi Sam!
I loved your tutorial, I've followed every steps and worked it perfectly! I wondered if I can translate your guides to Spanish and put it on my blog, mentioning yours and putting a link to your blog, of course.
Awaiting your reply, thank you very much.

Hi Sam.
Hope you can help me here. I have had my email server running for around 12 months now on a readyNAS box. Over the weekend I deployed another readynas server and performed a full back up of the MailDir's. Then I stopped receiving emails. I can send out by not receive. Here is the line from the "mail.log" file:

Jan 11 10:21:04 mail postfix/pipe[8000]: D75AC53A207: to=, relay=spamassassin, delay=6.2, delays=2/0.04/0/4.1, dsn=5.3.5, status=bounced (local configuration error. Command output: sendmail: account default not found: no configuration file available )

Any ideas where to look?

tks Darrin

Hi Darrin,

Is it a different distro? Although sendmail is a program in its own right, the "sendmail" command used by the spamassassin pipe in this tutorial is actually part of Postfix - it's a utility provided for compatibility with older programs that just happened to be useful for piping mail through some other filters ( postfix "sendmail" manpage).

Maybe the postfix "sendmail" command is configured differently?

First let's confirm you have the command and that it's from the postfix package (not the "real" sendmail!). This will give you the full path to the binary:

which sendmail

and then use the path in the following command to see which package provided the file:

dpkg -S /usr/sbin/sendmail

Sam

Hi Sam.

I took the easy option and rolled back to an image from a few weeks back, and then copied over the missing emails. It was going to take to long to resolve that issue.
I think my issue came about because I used some windows shares to do the backup copying. In future I will stick to Rsync, I think it does a better job.

Appreciate your response, and sorry to take up your time.

tks Drrin

Hi Sam,

I seem to have the same issue as Darrin. My incoming emails seems to 'bounce'. I received only one outside email (today) since 7 Feb 16. I haven't changed anything on the email server apart from updating on a weekly basis. I followed the steps you gave to Darrin:

pi@raspberrypi ~ $ which sendmail
/usr/sbin/sendmail
pi@raspberrypi ~ $ dpkg -S /usr/sbin/sendmail
postfix: /usr/sbin/sendmail
pi@raspberrypi ~ $

I also include an excerpt from my mail log:

Feb 14 06:25:16 raspberrypi postfix/pickup[14177]: 2DC6F3FE65: uid=0 from=
Feb 14 06:25:16 raspberrypi postfix/cleanup[15066]: 2DC6F3FE65: message-id=<20160214062516.2DC6F3FE65@courseworkresources.com>
Feb 14 06:25:16 raspberrypi postfix/qmgr[938]: 2DC6F3FE65: from=, size=767, nrcpt=1 (queue acti$
Feb 14 06:25:16 raspberrypi dovecot: lmtp(15076): Connect from local
Feb 14 06:25:16 raspberrypi dovecot: lmtp(15076, jo): v78wEswdwFbkOgAAKv1cSg: sieve: msgid=<20160214062516.2DC6F3FE65@coursew$
Feb 14 06:25:16 raspberrypi postfix/lmtp[15075]: 2DC6F3FE65: to=, orig_to=, relay=coursewor$
Feb 14 06:25:16 raspberrypi dovecot: lmtp(15076): Disconnect from local: Successful quit
Feb 14 06:25:16 raspberrypi postfix/qmgr[938]: 2DC6F3FE65: removed
Feb 14 06:26:52 raspberrypi postfix/smtpd[15081]: connect from unknown[208.85.55.186]
Feb 14 06:26:52 raspberrypi postfix/smtpd[15081]: NOQUEUE: reject: RCPT from unknown[208.85.55.186]: 450 4.7.1 , size=958, nrcpt=1 (queue active)
Feb 14 06:41:35 raspberrypi postfix/smtp[15295]: 7FD713FCEB: to=, relay=none, delay=311210, delays=311210/0.0$
Feb 14 06:41:55 raspberrypi postfix/smtpd[15297]: connect from unknown[208.85.55.186]
Feb 14 06:41:55 raspberrypi postfix/smtpd[15297]: NOQUEUE: reject: RCPT from unknown[208.85.55.186]: 450 4.7.1

Hi Jo,

Do the emails really "bounce"? If you use a freemail account like gmail to send an email, do you get a message in that account a while later saying it's undeliverable?

It seems strange that you've received one email but not any others (assuming this was from an external account, this means it must have been working at some point!).

Off the top of my head, a few things could have happened:

  • LAN IP address of your Pi changed (so ports are forwarded to the wrong machine, and you aren't getting any incoming connections)
  • If you use dynamic DNS, maybe it's not working? If your WAN IP address changed and your DNS records didn't, you wouldn't be receiving any more incoming connections.

If you check those and it's not either of them, maybe the best thing would be for me to send you a test email and see what happens on my end. Feel free to send me your email address and we can give it a go.

Sam

Hi Sam,

Maybe 'bounce' is not the correct technical word (apologies). My email personal address is jo@edujo.co.uk, my email server email address jo@courseworkresources.com (this is the one I've been testing for the last three months before I decide to move all my domains to the server.

I checked my MX record and that seems fine, however I couldn't telnet to courseworkresources.com (saw some advice from a previous page to someone with a similar issue).

I received an outside email shortly after I restarted docvecot and postfix...just tried it because I didn't know what else to do. I also just received another outside email from youtube.com...but when I email myself from jo@edujo.co.uk to jo@courseworkresources.com nothing comes through.

Please send me an email to check as you suggested.

Thx,

Jo

Are you expecting both accounts to be hosted on the same server? My server made connections to two different IP addresses to send to each account, here's what your DNS records say:

sam@T440s:~$ dig edujo.co.uk mx

; <<>> DiG 9.10.3-P3 <<>> edujo.co.uk mx
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29235
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 13, ADDITIONAL: 2

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;edujo.co.uk.                   IN      MX

;; ANSWER SECTION:
edujo.co.uk.            7194    IN      MX      10 mail.edujo.co.uk.

;; AUTHORITY SECTION:
.                       272521  IN      NS      h.root-servers.net.
.                       272521  IN      NS      i.root-servers.net.
.                       272521  IN      NS      c.root-servers.net.
.                       272521  IN      NS      m.root-servers.net.
.                       272521  IN      NS      l.root-servers.net.
.                       272521  IN      NS      k.root-servers.net.
.                       272521  IN      NS      f.root-servers.net.
.                       272521  IN      NS      d.root-servers.net.
.                       272521  IN      NS      j.root-servers.net.
.                       272521  IN      NS      b.root-servers.net.
.                       272521  IN      NS      a.root-servers.net.
.                       272521  IN      NS      g.root-servers.net.
.                       272521  IN      NS      e.root-servers.net.

;; ADDITIONAL SECTION:
mail.edujo.co.uk.       7194    IN      A       79.170.40.139

;; Query time: 2 msec
;; SERVER: 192.168.1.2#53(192.168.1.2)
;; WHEN: Sun Feb 14 12:28:16 GMT 2016
;; MSG SIZE  rcvd: 288

sam@T440s:~$ dig courseworkresources.com mx
                                                                                                                                                                                             
; <<>> DiG 9.10.3-P3 <<>> courseworkresources.com mx                                                                                                                                         
;; global options: +cmd                                                                                                                                                                      
;; Got answer:                                                                                                                                                                               
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58730                                                                                                                                    
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 13, ADDITIONAL: 2                                                                                                                        
                                                                                                                                                                                             
;; OPT PSEUDOSECTION:                                                                                                                                                                        
; EDNS: version: 0, flags:; udp: 4096                                                                                                                                                        
;; QUESTION SECTION:                                                                                                                                                                         
;courseworkresources.com.       IN      MX                                                                                                                                                   
                                                                                                                                                                                             
;; ANSWER SECTION:                                                                                                                                                                           
courseworkresources.com. 10496  IN      MX      10 courseworkresources.com.                                                                                                                  
                                                                                                                                                                                             
;; AUTHORITY SECTION:                                                                                                                                                                        
.                       272498  IN      NS      j.root-servers.net.                                                                                                                          
.                       272498  IN      NS      c.root-servers.net.                                                                                                                          
.                       272498  IN      NS      m.root-servers.net.
.                       272498  IN      NS      e.root-servers.net.
.                       272498  IN      NS      f.root-servers.net.
.                       272498  IN      NS      g.root-servers.net.
.                       272498  IN      NS      d.root-servers.net.
.                       272498  IN      NS      l.root-servers.net.
.                       272498  IN      NS      b.root-servers.net.
.                       272498  IN      NS      i.root-servers.net.
.                       272498  IN      NS      a.root-servers.net.
.                       272498  IN      NS      k.root-servers.net.
.                       272498  IN      NS      h.root-servers.net.

;; ADDITIONAL SECTION:
courseworkresources.com. 10496  IN      A       79.69.87.77

;; Query time: 2 msec
;; SERVER: 192.168.1.2#53(192.168.1.2)
;; WHEN: Sun Feb 14 12:28:39 GMT 2016
;; MSG SIZE  rcvd: 295

Sam

Hi Sam,

I was thinking of hosting both on the server or to move to one new domain completely because I get so much spam on a daily basis...

Also just saw that I can't email you from edujo email...so I guess the issue is on the edujo side...

What I've also noticed going through the dns settings for ddclient is that although the config file is ssl=yes it shows the following:

pi@raspberrypi ~ $ sudo ddclient -debug -verbose -noquiet
...some parts I deleted to shorten the text...
CONNECT: dynamicdns.park-your-domain.com
CONNECTED: using HTTP

should it not show "using SSL" or something?

Regards,

Jo

Hi Sam,

courseworkresources.com and edujo.co.uk are hosted with heartinternet, but I'm using namecheap for the dns for courseworkresources.com

Eventually I'll transfer to namecheap with all my domains...

Regards,

Jo

Can you use tail -f /var/log/mail.log to tell me what you see on the edujo account when you attempt to send an email to my server?

Sam

Hi Sam,

This is what I see when I send an email from courseworkresources to edujo and to you:

Feb 14 18:24:19 raspberrypi postfix/smtpd[25238]: connect from localhost[::1]
Feb 14 18:24:19 raspberrypi postfix/smtpd[25238]: 1505641E67: client=localhost[::1]
Feb 14 18:24:19 raspberrypi postfix/cleanup[25241]: 1505641E67: message-id=<1379c4f2473fad107af3e0ed1eb2cbcf.squirrel@192.168.1.99>
Feb 14 18:24:19 raspberrypi postfix/qmgr[17818]: 1505641E67: from=, size=735, nrcpt=2 (queue active)
Feb 14 18:24:19 raspberrypi postfix/smtpd[25238]: disconnect from localhost[::1]
Feb 14 18:24:19 raspberrypi spamc[25245]: connect to spamd on ::1 failed, retrying (#1 of 3): Connection refused
Feb 14 18:24:19 raspberrypi spamc[25245]: connect to spamd on 127.0.0.1 failed, retrying (#1 of 3): Connection refused
Feb 14 18:24:19 raspberrypi spamc[25246]: connect to spamd on ::1 failed, retrying (#1 of 3): Connection refused
Feb 14 18:24:19 raspberrypi spamc[25246]: connect to spamd on 127.0.0.1 failed, retrying (#1 of 3): Connection refused
Feb 14 18:24:19 raspberrypi dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=25253, secured, session=
Feb 14 18:24:19 raspberrypi dovecot: imap(jo): Disconnected: Logged out in=642 out=525
Feb 14 18:24:20 raspberrypi dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=25261, secured, session=
Feb 14 18:24:20 raspberrypi dovecot: imap(jo): Disconnected: Logged out in=318 out=6336
Feb 14 18:24:20 raspberrypi spamc[25245]: connect to spamd on ::1 failed, retrying (#2 of 3): Connection refused
Feb 14 18:24:20 raspberrypi spamc[25245]: connect to spamd on 127.0.0.1 failed, retrying (#2 of 3): Connection refused
Feb 14 18:24:20 raspberrypi spamc[25246]: connect to spamd on ::1 failed, retrying (#2 of 3): Connection refused
Feb 14 18:24:20 raspberrypi spamc[25246]: connect to spamd on 127.0.0.1 failed, retrying (#2 of 3): Connection refused
Feb 14 18:24:21 raspberrypi spamc[25245]: connect to spamd on ::1 failed, retrying (#3 of 3): Connection refused
Feb 14 18:24:21 raspberrypi spamc[25245]: connect to spamd on 127.0.0.1 failed, retrying (#3 of 3): Connection refused
Feb 14 18:24:21 raspberrypi spamc[25245]: connection attempt to spamd aborted after 3 retries
Feb 14 18:24:21 raspberrypi spamc[25246]: connect to spamd on ::1 failed, retrying (#3 of 3): Connection refused
Feb 14 18:24:21 raspberrypi spamc[25246]: connect to spamd on 127.0.0.1 failed, retrying (#3 of 3): Connection refused
Feb 14 18:24:21 raspberrypi spamc[25246]: connection attempt to spamd aborted after 3 retries
Feb 14 18:24:21 raspberrypi postfix/pickup[24906]: 99A3641E77: uid=113 from=
Feb 14 18:24:21 raspberrypi postfix/cleanup[25241]: 99A3641E77: message-id=<1379c4f2473fad107af3e0ed1eb2cbcf.squirrel@192.168.1.99>
Feb 14 18:24:21 raspberrypi postfix/pipe[25242]: 1505641E67: to=, relay=spamassassin, delay=2.6, delays=0.45/0.03/0/2.1, dsn=2.0.0, status=sent (delivered via spamassassin service)
Feb 14 18:24:21 raspberrypi postfix/qmgr[17818]: 99A3641E77: from=, size=855, nrcpt=1 (queue active)
Feb 14 18:24:21 raspberrypi postfix/pickup[24906]: A1E3741E73: uid=113 from=
Feb 14 18:24:21 raspberrypi postfix/cleanup[25241]: A1E3741E73: message-id=<1379c4f2473fad107af3e0ed1eb2cbcf.squirrel@192.168.1.99>
Feb 14 18:24:21 raspberrypi postfix/pipe[25244]: 1505641E67: to=, relay=spamassassin, delay=2.6, delays=0.45/0.06/0/2.1, dsn=2.0.0, status=sent (delivered via spamassassin service)
Feb 14 18:24:21 raspberrypi postfix/qmgr[17818]: 1505641E67: removed
Feb 14 18:24:21 raspberrypi postfix/qmgr[17818]: A1E3741E73: from=, size=855, nrcpt=1 (queue active)
Feb 14 18:24:22 raspberrypi postfix/smtp[25267]: A1E3741E73: to=, relay=samhobbs.co.uk[195.166.151.235]:25, delay=0.48, delays=0.06/0.04/0.26/0.11, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 125F4141648)
Feb 14 18:24:22 raspberrypi postfix/qmgr[17818]: A1E3741E73: removed
Feb 14 18:24:22 raspberrypi postfix/smtp[25266]: 99A3641E77: to=, relay=mail.edujo.co.uk[79.170.40.139]:25, delay=1.1, delays=0.05/0.04/0.15/0.88, dsn=2.0.0, status=sent (250 OK id=1aV1LK-0004Rg-MV)
Feb 14 18:24:22 raspberrypi postfix/qmgr[17818]: 99A3641E77: removed

Regards,

Jo

Hi Sam,

...and this is the log when I send an email from edujo (not part of raspi server) to courseworkresources and yourself...

Feb 14 18:33:05 raspberrypi dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=25364, secured, session=
Feb 14 18:33:05 raspberrypi dovecot: imap(jo): Disconnected: Logged out in=79 out=764
Feb 14 18:35:15 raspberrypi postfix/smtpd[25447]: connect from mail139.extendcp.co.uk[79.170.40.139]
Feb 14 18:35:15 raspberrypi postfix/smtpd[25447]: F034C41E67: client=mail139.extendcp.co.uk[79.170.40.139]
Feb 14 18:35:16 raspberrypi postfix/cleanup[25451]: F034C41E67: message-id=<000501d16756$7f5859c0$7e090d40$@edujo.co.uk>
Feb 14 18:35:16 raspberrypi postfix/qmgr[17818]: F034C41E67: from=, size=3147, nrcpt=1 (queue active)
Feb 14 18:35:16 raspberrypi postfix/smtpd[25447]: disconnect from mail139.extendcp.co.uk[79.170.40.139]
Feb 14 18:35:16 raspberrypi spamc[25453]: connect to spamd on ::1 failed, retrying (#1 of 3): Connection refused
Feb 14 18:35:16 raspberrypi spamc[25453]: connect to spamd on 127.0.0.1 failed, retrying (#1 of 3): Connection refused
Feb 14 18:35:17 raspberrypi spamc[25453]: connect to spamd on ::1 failed, retrying (#2 of 3): Connection refused
Feb 14 18:35:17 raspberrypi spamc[25453]: connect to spamd on 127.0.0.1 failed, retrying (#2 of 3): Connection refused
Feb 14 18:35:18 raspberrypi spamc[25453]: connect to spamd on ::1 failed, retrying (#3 of 3): Connection refused
Feb 14 18:35:18 raspberrypi spamc[25453]: connect to spamd on 127.0.0.1 failed, retrying (#3 of 3): Connection refused
Feb 14 18:35:18 raspberrypi spamc[25453]: connection attempt to spamd aborted after 3 retries
Feb 14 18:35:18 raspberrypi postfix/pickup[24906]: 215DB41E77: uid=113 from=
Feb 14 18:35:18 raspberrypi postfix/pipe[25452]: F034C41E67: to=, relay=spamassassin, delay=2.2, delays=0.07/0.03/0/2.1, dsn=2.0.0, status=sent (delivered via spamassassin service)
Feb 14 18:35:18 raspberrypi postfix/qmgr[17818]: F034C41E67: removed
Feb 14 18:35:18 raspberrypi postfix/cleanup[25451]: 215DB41E77: message-id=<000501d16756$7f5859c0$7e090d40$@edujo.co.uk>
Feb 14 18:35:18 raspberrypi postfix/qmgr[17818]: 215DB41E77: from=, size=3267, nrcpt=1 (queue active)
Feb 14 18:35:18 raspberrypi dovecot: lmtp(25458): Connect from local
Feb 14 18:35:18 raspberrypi dovecot: lmtp(25458, jo): MLMjD+bIwFZyYwAAKv1cSg: sieve: msgid=<000501d16756$7f5859c0$7e090d40$@edujo.co.uk>: stored mail into mailbox 'INBOX'
Feb 14 18:35:18 raspberrypi postfix/lmtp[25457]: 215DB41E77: to=, relay=courseworkresources.com[private/dovecot-lmtp], delay=0.25, delays=0.05/0.03/0.06/0.11, dsn=2.0.0, status=sent (250 2.0.0 MLMjD+bIwFZyYwAAKv1cSg Saved)
Feb 14 18:35:18 raspberrypi postfix/qmgr[17818]: 215DB41E77: removed
Feb 14 18:35:18 raspberrypi dovecot: lmtp(25458): Disconnect from local: Successful quit
Feb 14 18:35:50 raspberrypi dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=25467, secured, session=
Feb 14 18:35:50 raspberrypi dovecot: imap(jo): Disconnected: Logged out in=79 out=764

Regards,

Jo

PS - My edujo.co.uk is not part of the raspi server. It is hosted somewhere by heartinternet (extendcp)...

Hi Sam,
I have a DNS agent service. My DNS setting is "v=spf1 ~all" on "TXT". I think is fine.
I also check the mail.log. There is a information 451 4.3.5 Server configuration error same as my gmail gets a information, a bound email. I can't figure out how a cause makes this situation. Wish your help.

Mar 7 09:17:22 raspberrypi dovecot: imap(pi): Disconnected: Logged out in=79 out=728
Mar 7 09:25:48 raspberrypi postfix/postfix-script[11908]: refreshing the Postfix mail system
Mar 7 09:25:48 raspberrypi postfix/master[10077]: reload -- version 2.11.3, configuration /etc/postfix
Mar 7 09:25:59 raspberrypi postfix/master[10077]: terminating on signal 15
Mar 7 09:26:01 raspberrypi postfix/master[12072]: daemon started -- version 2.11.3, configuration /etc/postfix
Mar 7 09:26:39 raspberrypi postfix/smtpd[12081]: warning: database /etc/postfix/helo_access.db is older than source file /etc/postfix/helo_access
Mar 7 09:26:39 raspberrypi postfix/smtpd[12081]: connect from mail-io0-f182.google.com[209.85.223.182]
Mar 7 09:26:41 raspberrypi postfix/smtpd[12081]: warning: unknown smtpd restriction: "reject_unknow_helo_hostname"
Mar 7 09:26:41 raspberrypi postfix/smtpd[12081]: NOQUEUE: reject: RCPT from mail-io0-f182.google.com[209.85.223.182]: 451 4.3.5 Server configuration error; from= to= proto=ESMTP helo=
Mar 7 09:26:41 raspberrypi postfix/cleanup[12086]: C0BB4821A7: message-id=<20160307012641.C0BB4821A7@mail.jeffhost.idv.tw>
Mar 7 09:26:41 raspberrypi postfix/smtpd[12081]: disconnect from mail-io0-f182.google.com[209.85.223.182]
Mar 7 09:26:41 raspberrypi postfix/qmgr[12080]: C0BB4821A7: from=, size=1350, nrcpt=1 (queue active)
Mar 7 09:26:41 raspberrypi postfix/local[12087]: C0BB4821A7: to=, orig_to=, relay=local, delay=0.14, delays=0.09/0.03/0/0.02, dsn=2.0.0, status=sent (delivered to maildir)
Mar 7 09:26:41 raspberrypi postfix/qmgr[12080]: C0BB4821A7: removed
Mar 7 09:27:27 raspberrypi dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=12098, secured, session=
Mar 7 09:27:27 raspberrypi dovecot: imap(pi): Disconnected: Logged out in=44 out=831
Mar 7 09:27:28 raspberrypi dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=12107, secured, session=
Mar 7 09:27:28 raspberrypi dovecot: imap(pi): Disconnected: Logged out in=261 out=1779
Mar 7 09:27:28 raspberrypi dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=12115, secured, session=
Mar 7 09:27:28 raspberrypi dovecot: imap(pi): Disconnected: Logged out in=292 out=1947
Mar 7 09:27:30 raspberrypi dovecot: imap-login: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=12123, secured, session=
Mar 7 09:27:30 raspberrypi dovecot: imap(pi): Disconnected: Logged out in=292 out=1947

Looks like postfix isn't running because you made a typo in your helo restriction list.

You also need to postmap your helo_access file because you changed it after you postmapped it last time.

Do both of those, then restart postfix and see if it fixes the problem.

Sam

The other mail appjeffapp@gmail.com is fine to send to my @mail.jeffhost.idv.tw.
I raise two question to you.
One is how to change the default user "pi" to be others's name. Is it possible?
The other one is about squirrelmail port working on both 443 and 80.
I am not sure the @mail.jeffhost.idv.tw working for your mail domain or not-It's a intriguing question.

Hi Sam,

Probably a stupid question:

I know I can 'safely' update and upgrade...

With my email and owncloud servers now installed and working fine, is it also 'safe' to sudo apt-get dist-upgrade? It won't mess up any settings for the two servers?

Regards,

Jo

Hi Sam,

I've moved my domain edujo.co.uk over to namecheap now as well and have setup my email to also include this domain. We used to get loads of spam by 'default' and I was hoping spamassassin would sort this out one I've moved it over to my Raspi mail server. With all my accounts from edujo.co.uk I suddenly started receiving loads of "Mail Delivery System Mail delivery failed: return to sender". Most of these have stopped within a few days, because I moved them over to the spam folder, etc. but the one account just keeps receiving these emails no matter what I try.

When I look at the emails in detail they seem to come from my previous pop/smtp service mail.edujo.co.uk via the extend cp that I had with Heartinternet. The usernames are the same which is why I get them. I received over a 1000 emails since yesterday, up to 6 each minute...

At the moment I'm moving about 20 or so to the spam folder and deleting the rest manually.

Any ideas?

Regards,

Jo

PS I can email you a printscreen of the inbox if that helps

Jo,

You should be worried about that amount of email returned to sender. What if they are real messages that were sent from your server? I'm assuming you're not sending 1000 legitimate emails per day!

Maybe one of the logins for your server has been compromised (did you forget to remove the user "pi" or change the password from "raspberry"?).

Sam

Pages

Add new comment