{"id":786,"date":"2020-03-07T11:51:19","date_gmt":"2020-03-07T10:51:19","guid":{"rendered":"https:\/\/codedoneright.eu\/?page_id=786"},"modified":"2021-02-20T05:03:10","modified_gmt":"2021-02-20T04:03:10","slug":"email-server","status":"publish","type":"page","link":"https:\/\/codedoneright.eu\/?page_id=786","title":{"rendered":"Email server"},"content":{"rendered":"\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/d\/d9\/Postfix-logo.png\" alt=\"postfix email transfer agent\"\/><figcaption><a href=\"http:\/\/www.postfix.org\/\">Postfix <\/a>logo<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dovecot.org\/typo3conf\/ext\/dvc_content\/Resources\/Public\/Images\/dovecot_logo_vector.svg\" alt=\"dovecot email\" width=\"150\" height=\"60\"\/><figcaption><a href=\"https:\/\/www.dovecot.org\/\">Dovecot<\/a> logo<\/figcaption><\/figure><\/div>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\"><\/div>\n\n\n\n<p>In this tutorial I will show you how to set up an email server on your Raspberry Pi. Read <strong><em>carefully<\/em><\/strong> and <em><strong>do not<\/strong><\/em> skip any steps!<\/p>\n\n\n\n<p><strong>CAUTION<\/strong> unfortunately some ISPs simply block email protocols for sending email. Their rationale is &#8220;we are fighting spammers&#8221;. Changing ISP or upgrading to a business\/static IP package is the only thing you can do in such a case.<\/p>\n\n\n\n<p><strong>CAUTION<\/strong> this tutorial assumes you are using IPv4 as I have no experience with IPv6.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Requirements<\/h3>\n\n\n\n<ul><li><a href=\"https:\/\/codedoneright.eu\/?page_id=309\">Domain<\/a><\/li><li><a href=\"https:\/\/codedoneright.eu\/?page_id=583\">SSL certificate<\/a><\/li><\/ul>\n\n\n\n<p>In order to receive email you have to have a domain. It can be a free one from a registrar like  <a href=\"http:\/\/freenom.com\">freenom.com<\/a>, and for testing purposes it will do nicely. However, if you plan on actually using the email, you should invest in a proper domain.<\/p>\n\n\n\n<p>SSL certificate is not required, however, your email will be sent <strong><em>in the open<\/em><\/strong> without it. This is <strong>NOT<\/strong> advised and that is why I am marking it as a necessity. The tutorial assumes usage of an SSL certificate. It is free so there is no excuse for not using one. Check out my tutorial <a href=\"https:\/\/codedoneright.eu\/?page_id=583\">here<\/a> on how to obtain a certificate.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">A bit of theory<\/h3>\n\n\n\n<p>Before we dive into the tutorial itself, you need to understand a thing or two about email servers. <\/p>\n\n\n\n<p>First of all, email server is a service that absolutely requires 24\/7 uptime of your machine if you plan to receive emails. You simply cannot just switch your server on to download stuff and turn it off again. This is because when an email is sent, a transfer server is looking up your server to deliver the message. If it cannot deliver it instantly, it just gives up telling the sender that your server is unreachable. You really do need your machine to run 24\/7.<\/p>\n\n\n\n<p>Email server protocols is yet another thing to be mindful of. We have two \u2013 POP3 and IMAP. In short POP3 downloads all messages to a device accessing the email server, and messages are erased form the server. IMAP only synchronizes your messages so that they can be accessed by different means, they stay on the server. You can read more about <a href=\"https:\/\/en.wikipedia.org\/wiki\/Post_Office_Protocol\">POP<\/a> and <a href=\"https:\/\/en.wikipedia.org\/wiki\/Internet_Message_Access_Protocol\">IMAP<\/a> on Wikipedia. Due to obvious advantages, you will set up only IMAP server, as POP3 is obsolete and not useful anymore. <\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Configure your domain properly<\/h3>\n\n\n\n<p>If you already have a domain, you need to configure it for email now. I have a separate tutorial on that, so I will simply point you to <a href=\"https:\/\/codedoneright.eu\/?page_id=309\">this page<\/a> rather than repeat myself. Once you have that sorted out, come back to this tutorial.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Installing Postfix and Dovecot<\/h3>\n\n\n\n<p>This one is quite easy. Just issue the following command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install postfix dovecot-core dovecot-imapd<\/code><\/pre>\n\n\n\n<p>When asked about mail <em>server configuration type<\/em>, select <em>Internet Site<\/em>.<\/p>\n\n\n\n<p>When asked about <em>System mail name<\/em>, type your <em>$FQDN<\/em>. Postfix will read the domain from your system information. If it is not displayed here then consider using raspi-config to rectify that. Check bottom of <a href=\"http:\/\/codedoneright.eu\/?page_id=78\">this tutorial<\/a> for a hint.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Email folders<\/h3>\n\n\n\n<p>There are a few ways to set up folders for your mail. In my opinion, however, it is best to keep messages in the user&#8217;s home folder, each one in a separate file.<\/p>\n\n\n\n<p>Run the following commands<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo maildirmake.dovecot \/etc\/skel\/Maildir\nsudo maildirmake.dovecot \/etc\/skel\/Maildir\/.Drafts\nsudo maildirmake.dovecot \/etc\/skel\/Maildir\/.Sent\nsudo maildirmake.dovecot \/etc\/skel\/Maildir\/.Spam\nsudo maildirmake.dovecot \/etc\/skel\/Maildir\/.Trash\nsudo maildirmake.dovecot \/etc\/skel\/Maildir\/.Templates<\/code><\/pre>\n\n\n\n<p>The above will create mail directories in <em>\/etc\/skel<\/em> folder. This is a special folder that serves as a template for any new system account. If you create a new account everything from skel will be copied into the user&#8217;s <em>home<\/em> directory. Including our newly created email directories.<\/p>\n\n\n\n<p>The user you are currently logged in as do not have those folders just yet. You need to copy them to your user&#8217;s home directory. Run the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo cp -r \/etc\/skel\/Maildir ~\/\nsudo chown -R $USER:$USER ~\/Maildir\nsudo chmod -R 700 ~\/Maildir<\/code><\/pre>\n\n\n\n<p>Substitute <em>$USER<\/em> with your username. Do not set folder permissions other than <em>700<\/em>! Setting them to 700 means that only the owner can read, write and execute files in that directory.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Postfix configuration<\/h3>\n\n\n\n<p>Now you need to configure Postfix so that you can send email properly. Modify <em>main.cf<\/em> file with the following command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/postfix\/main.cf<\/code><\/pre>\n\n\n\n<p>Now modify the following two entries so that they look exactly like the below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>inet_protocols = ipv4\nmyhostname = $FQDN<\/code><\/pre>\n\n\n\n<p><em>$FQDN<\/em> being the domain you are using. Again, this should be configured automatically, but I am specifying this just in case.<\/p>\n\n\n\n<p>Now add the following at the bottom<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>smtpd_recipient_restrictions =\n\tpermit_sasl_authenticated,\n\tpermit_mynetworks,\n\treject_unauth_destination\n\nsmtpd_helo_required = yes\nsmtpd_helo_restrictions =\n\tpermit_mynetworks,\n\tpermit_sasl_authenticated,\n\treject_invalid_helo_hostname,\n\treject_non_fqdn_helo_hostname,\n\treject_unknown_helo_hostname\n\tcheck_helo_access hash:\/etc\/postfix\/helo_access\n\nsmtpd_sasl_type = dovecot\nsmtpd_sasl_path = private\/auth\nsmtpd_sasl_auth_enable = yes\n\nsmtpd_tls_auth_only = yes\n\nhome_mailbox = Maildir\/\nmailbox_command =<\/code><\/pre>\n\n\n\n<p><strong>CAUTION<\/strong> if said entries exist then comment them out and put everything at the bottom. Order in this section matters!<\/p>\n\n\n\n<p>The above configures Postfix so that bots and spammers cannot send emails claiming to be you, in short. Additionally it configures <em>helo<\/em> handshake required to bypass spam filters. Think of it as the server saying <em>&#8220;Helo, I&#8217;m $FQND, please accept email from me.&#8221;<\/em><\/p>\n\n\n\n<p>Set certificate paths changing the following two lines<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>smtpd_tls_cert_file=\/etc\/ssl\/certs\/ssl-cert-snakeoil.pem\nsmtpd_tls_key_file=\/etc\/ssl\/private\/ssl-cert-snakeoil.key<\/code><\/pre>\n\n\n\n<p>Change the above, so that it reflects your certificate obtained by the Certbot in <a href=\"http:\/\/codedoneright.eu\/?page_id=583\">this tutorial<\/a>.<\/p>\n\n\n\n<p>Your path will look similar to the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>smtpd_tls_cert_file=\/etc\/letsencrypt\/live\/$FQDN\/fullchain.pem\nsmtpd_tls_key_file=\/etc\/letsencrypt\/live\/$FQDN\/privkey.pem<\/code><\/pre>\n\n\n\n<p>If you do not change the certificate path, when you try to send an email your client (e.g. Outlook or Thunderbird) will tell you that your certificate is self-signed, and that you should not trust it. Just like on the screenshot below.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"482\" height=\"295\" src=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/cert_warning.png\" alt=\"email cert warning\" class=\"wp-image-873\" srcset=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/cert_warning.png 482w, https:\/\/codedoneright.eu\/wp-content\/uploads\/cert_warning-300x184.png 300w\" sizes=\"(max-width: 482px) 100vw, 482px\" \/><\/figure><\/div>\n\n\n\n<p>Additionally, add the two following lines if your mail is delivered unencrypted<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>smtp_use_tls=yes\nsmtp_tls_security_level = encrypt<\/code><\/pre>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Blocking spammers with Postfix HELO controls<\/h4>\n\n\n\n<p>This one is for spam control. In case a server lies about its identity and tries to send emails as you. No legitimate server is lying about its identity, ever.<\/p>\n\n\n\n<p>Create <em>helo_access<\/em> file with the following command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/postfix\/helo_access<\/code><\/pre>\n\n\n\n<p>Inside add the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$FQDN\tREJECT\tGet lost - you're lying about who you are\nmail.$FQDN\tREJECT\tGet lost - you're lying about who you are\n$Your_IP\tREJECT\tGet lost - you're lying about who you are\nlocalhost\tREJECT\tGet lost - you're lying about who you are<\/code><\/pre>\n\n\n\n<p>Now tell Postfix to map the file with the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo postmap \/etc\/postfix\/helo_access<\/code><\/pre>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Dovecot configuration<\/h3>\n\n\n\n<p>Now you need to configure Dovecot. I will break down this section by files so it is a bit easier to work with.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">dovecot.conf<\/h4>\n\n\n\n<p>Run the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/dovecot\/dovecot.conf<\/code><\/pre>\n\n\n\n<p>and modify <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#listen = *, ::<\/code><\/pre>\n\n\n\n<p>to<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>listen = *<\/code><\/pre>\n\n\n\n<p>This removes IPv6 support. As I said before, I have no experience with IPv6 so I chose to disable it.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">10-mail.conf<\/h4>\n\n\n\n<p>Run the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/dovecot\/conf.d\/10-mail.conf<\/code><\/pre>\n\n\n\n<p>Now modify the <em>mail_location<\/em> entry so that it looks exactly like the below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mail_location = maildir:~\/Maildir<\/code><\/pre>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">10-master.conf<\/h4>\n\n\n\n<p>Run the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/dovecot\/conf.d\/10-master.conf<\/code><\/pre>\n\n\n\n<p><strong>CAUTION<\/strong> Remember that sections start and end with braces <strong><em>{ }<\/em><\/strong> signs. You have to comment each and every line, including braces! Leaving a brace will lead to misconfiguring Dovecot and it will not work properly!<\/p>\n\n\n\n<p>Comment out the whole existing section <em><strong>service auth<\/strong><\/em> by adding <strong><em>#<\/em><\/strong> signs at the start of every line.<\/p>\n\n\n\n<p>Add a <strong>new<\/strong> section <strong><em>service auth<\/em><\/strong>, like this<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>service auth {\n        unix_listener \/var\/spool\/postfix\/private\/auth {\n                mode = 0660\n                user = postfix\n                group = postfix\n        }\n}<\/code><\/pre>\n\n\n\n<p>Uncomment port lines in the following section (and modify if it looks any different)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tservice imap-login {\n\t  inet_listener imap {\n\t    port = 143\n\t  } \n\t  inet_listener imaps {\n\t    port = 993\n\t    ssl = yes\n\t  }\n\t}<\/code><\/pre>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">10-auth.conf<\/h4>\n\n\n\n<p>Run the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/dovecot\/conf.d\/10-auth.conf<\/code><\/pre>\n\n\n\n<p>Now modify the following two entries so that they look exactly like the below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>disable_plaintext_auth = no\nauth_mechanisms = plain login<\/code><\/pre>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">master.cf<\/h4>\n\n\n\n<p>Run the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/postfix\/master.cf<\/code><\/pre>\n\n\n\n<p>Uncomment the following lines, you may have to add text to the fourth line<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\tsmtps     inet  n       -       Y       -       -       smtpd\n\t  -o syslog_name=postfix\/smtps\n\t  -o smtpd_tls_wrappermode=yes\n\t  -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject<\/code><\/pre>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">10-ssl.conf<\/h4>\n\n\n\n<p>Run the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo nano \/etc\/dovecot\/conf.d\/10-ssl.conf<\/code><\/pre>\n\n\n\n<p>Now modify the following two entries so that they look exactly like the below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssl = yes\nssl_min_protocol = SSLv3\n#ssl_protocols = SSLv3<\/code><\/pre>\n\n\n\n<p>Set certificate paths changing the following two lines, so that they reflect your certificate obtained by the Certbot in <a href=\"https:\/\/codedoneright.eu\/?page_id=583\">this<\/a> tutorial <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssl_cert = &lt;\/etc\/dovecot\/dovecot.pem\nssl_key = &lt;\/etc\/dovecot\/private\/dovecot.pem<\/code><\/pre>\n\n\n\n<p>Your path will look like the following<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssl_cert = &lt;\/etc\/letsencrypt\/live\/$FQDN\/fullchain.pem\nssl_key = &lt;\/etc\/letsencrypt\/live\/$FQDN\/privkey.pem<\/code><\/pre>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Reboot<\/h3>\n\n\n\n<p>Now it is time to reboot your server so that configuration files will be reloaded. Just issue the following to reboot your machine<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo reboot now<\/code><\/pre>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Opening and forwarding ports for email<\/h3>\n\n\n\n<p>The following ports are responsible for handling email<\/p>\n\n\n\n<ul><li>25<\/li><li>143<\/li><li>465<\/li><li>993<\/li><\/ul>\n\n\n\n<p>Open them in UFW if you have it installed. Learn how to do that <a href=\"https:\/\/codedoneright.eu\/?page_id=187\">here<\/a>.<\/p>\n\n\n\n<p>You need to forward those ports to your server on your router as well. Learn how to do that <a href=\"https:\/\/codedoneright.eu\/?page_id=375\">here<\/a>.<\/p>\n\n\n\n<p><strong>CAUTION <\/strong>it just might happen that you will not be able to forward port 25 if you have a router from your ISP. A workaround is to use DMZ on your router. This basically means that your server will be exposed to all nasty bots and hackers from the outside and is NOT advised! You can open DMZ for a moment to check if it is working, but please disable it afterwards!<\/p>\n\n\n\n<p>Read more about the topic in <a href=\"https:\/\/www.grc.com\/nat\/nat.htm\">this article<\/a> by Steve Gibson. If you are still thinking about using DMZ.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">Using your email<\/h3>\n\n\n\n<p>Your email server is now ready. It is time to configure your email client.<\/p>\n\n\n\n<p>If you want to configure webmail client as well, check out <a href=\"https:\/\/codedoneright.eu\/?page_id=810\">this tutorial<\/a>.<\/p>\n\n\n\n<p><strong>NOTE<\/strong> I had problems with configuring Outlook 2016\/2019 with my server. For the life of mine I could not force it to connect. I had no such issues with Outlook 2010 though.<\/p>\n\n\n\n<p>Configuration will look the same on all email clients. I will use Thunderbird as an example.<\/p>\n\n\n\n<p>You can download Thunderbird for Windows from <a href=\"http:\/\/www.thunderbird.net\">www.thunderbird.net<\/a><\/p>\n\n\n\n<p>On <em>Debian\/Ubuntu<\/em> you can issue the following command to download Thunderbird from the repository<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install thunderbird<\/code><\/pre>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Configuring Thunderbird email client<\/h4>\n\n\n\n<p>Without further ado, open Thunderbird<\/p>\n\n\n\n<ul><li>Click on <em>Local folders<\/em><\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"637\" src=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/01-1024x637.png\" alt=\"thunderbird email\" class=\"wp-image-803\" srcset=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/01-1024x637.png 1024w, https:\/\/codedoneright.eu\/wp-content\/uploads\/01-300x187.png 300w, https:\/\/codedoneright.eu\/wp-content\/uploads\/01-768x478.png 768w, https:\/\/codedoneright.eu\/wp-content\/uploads\/01.png 1163w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<ul><li>Now click on <em>Email<\/em> in the <em>Accounts<\/em> section<\/li><li>Put down your credentials<ul><li><strong>Your name<\/strong> \u2013 put down the system account user name <\/li><li><strong>Email address<\/strong> \u2013 put down your user name followed by your domain name e.g. john@example.com<\/li><li><strong>Password<\/strong> \u2013 password for your system user name <\/li><\/ul><\/li><li>Click on <em>Continue<\/em><\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"466\" height=\"371\" src=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/02.png\" alt=\"thunderbird email\" class=\"wp-image-804\" srcset=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/02.png 466w, https:\/\/codedoneright.eu\/wp-content\/uploads\/02-300x239.png 300w\" sizes=\"(max-width: 466px) 100vw, 466px\" \/><\/figure><\/div>\n\n\n\n<p>You will be taken to the following window. As your server is not on the list of known providers, Thunderbird will not be able to find the correct settings, but that is expected.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"753\" height=\"371\" src=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/03.png\" alt=\"thunderbird email\" class=\"wp-image-806\" srcset=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/03.png 753w, https:\/\/codedoneright.eu\/wp-content\/uploads\/03-300x148.png 300w\" sizes=\"(max-width: 753px) 100vw, 753px\" \/><\/figure><\/div>\n\n\n\n<ul><li>Make sure you choose <em>Port<\/em>, <em>SSL<\/em> and <em>Authentication<\/em> settings exactly as on the screenshot above<\/li><li><strong><em>Server hostname<\/em><\/strong> \u2013 some email clients will put a full stop <em>&#8220;.&#8221;<\/em> before your domain name. Make sure to remove it!<\/li><\/ul>\n\n\n\n<p>Click on <em><strong>Done<\/strong><\/em>, and you should return to the main window.<\/p>\n\n\n\n<p>Try sending an email now. Send it to a Google account, some email services might block your email if you have a dynamic looking IP. Your message will most likely go to <em>SPAM<\/em> folder. Unless you have a PTR domain record.<\/p>\n\n\n\n<p><strong>Caution<\/strong> if you have not changed certificate path in Dovecot configuration you will be presented with a warning about a self-signed certificate. Similar to the one I showed you in Postfix configuration. Change it now, before proceeding.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Further email testing<\/h4>\n\n\n\n<p>If all went well your email has been sent and you can do one more test<\/p>\n\n\n\n<ul><li>Go to the following site \u2013 <a href=\"https:\/\/www.mail-tester.com\/\">www.mail-tester.com<\/a><\/li><li>Copy the email address <\/li><li>Send an email from your newly created account to that address<ul><li>Make the email look &#8216;normal&#8217;, do not just put a single word, and do not attach anything<\/li><\/ul><\/li><li>Click on <em>Then check your score<\/em><\/li><li>Look at the result, it will tell you what looks not right in your email<\/li><\/ul>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"478\" src=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/email_result_new-1024x478.jpg\" alt=\"email test result\" class=\"wp-image-879\" srcset=\"https:\/\/codedoneright.eu\/wp-content\/uploads\/email_result_new-1024x478.jpg 1024w, https:\/\/codedoneright.eu\/wp-content\/uploads\/email_result_new-300x140.jpg 300w, https:\/\/codedoneright.eu\/wp-content\/uploads\/email_result_new-768x359.jpg 768w, https:\/\/codedoneright.eu\/wp-content\/uploads\/email_result_new.jpg 1263w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption>This is the score of my email server. Due to not having DMARC and a static IP it deducted 1.4 points.<\/figcaption><\/figure><\/div>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Additional thoughts<\/h4>\n\n\n\n<p>Even if for some reason you are unable to receive email to your server. An outgoing email is still a valuable tool. It will help with other services such as WordPress, for sending password reset emails or NextCloud for reporting etc.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">A word of caution<\/h4>\n\n\n\n<p>Due to reliability issues like power\/internet outages and\/or administrator stupidity I would not recommend such a server for signing up with services like Steam, PSN or others which you can lose access to permanently due to email loss. You can lose a domain if you fail to renew it for some reason, but I do not foresee Google overlord loosing Gmail anytime soon\u2026 On the other hand if you need a server for a non-profit, your MMO guild, local bakery, car mechanic service you are just starting, an event you are hosting or the like, have at it! You can always migrate to a full-fledged server and ditch Raspberry should the need arise down the line and with that kind of experience it will be a breeze! Everybody starts somewhere.<\/p>\n\n\n\n<div style=\"height:56px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h4 class=\"wp-block-heading\">Conclusion<\/h4>\n\n\n\n<p>Email setup is not really that hard, however, due to your ISP it might just not work at all. Even if your ISP is not blocking outgoing mail, you will most likely deal with dynamic IP address issues and at some point you will be flagged by SPAMHAUS as a potential spammer. As mentioned before, without a proper static IP address and a PTR record running an email server is not that useful. But for basic use it will be just right.<\/p>\n\n\n\n<p>This tutorial exists only because I found a wonderful and a detailed guide to setting up an email on <a href=\"http:\/\/samhobbs.co.uk\/raspberry-pi-email-server\">Sam Hobbs&#8217;<\/a> website. Although his version is much less newbie friendly than mine. Check it out though, it is a good read!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial I will show you how to set up an email server on your Raspberry Pi. Read carefully and do not skip any steps! CAUTION unfortunately some ISPs simply block email protocols for sending email. Their rationale is&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"parent":483,"menu_order":40,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Email server on your Raspberry Pi &#8212; Code Done Right!<\/title>\n<meta name=\"description\" content=\"Learn how to set up your very own, fully functional email server on your Raspberry Pi or Debian system. Take controll of your emails with this tutorial!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codedoneright.eu\/?page_id=786\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"Email server on your Raspberry Pi &#8212; Code Done Right!\" \/>\n<meta name=\"twitter:description\" content=\"Learn how to set up your very own, fully functional email server on your Raspberry Pi or Debian system. Take controll of your emails with this tutorial!\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/d\/d9\/Postfix-logo.png\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codedoneright.eu\/?page_id=786\",\"url\":\"https:\/\/codedoneright.eu\/?page_id=786\",\"name\":\"Email server on your Raspberry Pi &#8212; Code Done Right!\",\"isPartOf\":{\"@id\":\"https:\/\/codedoneright.eu\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codedoneright.eu\/?page_id=786#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codedoneright.eu\/?page_id=786#primaryimage\"},\"thumbnailUrl\":\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/d\/d9\/Postfix-logo.png\",\"datePublished\":\"2020-03-07T10:51:19+00:00\",\"dateModified\":\"2021-02-20T04:03:10+00:00\",\"description\":\"Learn how to set up your very own, fully functional email server on your Raspberry Pi or Debian system. Take controll of your emails with this tutorial!\",\"breadcrumb\":{\"@id\":\"https:\/\/codedoneright.eu\/?page_id=786#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codedoneright.eu\/?page_id=786\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codedoneright.eu\/?page_id=786#primaryimage\",\"url\":\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/d\/d9\/Postfix-logo.png\",\"contentUrl\":\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/d\/d9\/Postfix-logo.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codedoneright.eu\/?page_id=786#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codedoneright.eu\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Server features\",\"item\":\"https:\/\/codedoneright.eu\/?page_id=483\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Email server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codedoneright.eu\/#website\",\"url\":\"https:\/\/codedoneright.eu\/\",\"name\":\"Code Done Right!\",\"description\":\"Raspberry Pi server guides\",\"publisher\":{\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codedoneright.eu\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568\",\"name\":\"CodeDoneRight\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png\",\"contentUrl\":\"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png\",\"width\":120,\"height\":120,\"caption\":\"CodeDoneRight\"},\"logo\":{\"@id\":\"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/codedoneright.eu\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Email server on your Raspberry Pi &#8212; Code Done Right!","description":"Learn how to set up your very own, fully functional email server on your Raspberry Pi or Debian system. Take controll of your emails with this tutorial!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codedoneright.eu\/?page_id=786","twitter_card":"summary_large_image","twitter_title":"Email server on your Raspberry Pi &#8212; Code Done Right!","twitter_description":"Learn how to set up your very own, fully functional email server on your Raspberry Pi or Debian system. Take controll of your emails with this tutorial!","twitter_image":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/d\/d9\/Postfix-logo.png","twitter_misc":{"Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/codedoneright.eu\/?page_id=786","url":"https:\/\/codedoneright.eu\/?page_id=786","name":"Email server on your Raspberry Pi &#8212; Code Done Right!","isPartOf":{"@id":"https:\/\/codedoneright.eu\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codedoneright.eu\/?page_id=786#primaryimage"},"image":{"@id":"https:\/\/codedoneright.eu\/?page_id=786#primaryimage"},"thumbnailUrl":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/d\/d9\/Postfix-logo.png","datePublished":"2020-03-07T10:51:19+00:00","dateModified":"2021-02-20T04:03:10+00:00","description":"Learn how to set up your very own, fully functional email server on your Raspberry Pi or Debian system. Take controll of your emails with this tutorial!","breadcrumb":{"@id":"https:\/\/codedoneright.eu\/?page_id=786#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codedoneright.eu\/?page_id=786"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codedoneright.eu\/?page_id=786#primaryimage","url":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/d\/d9\/Postfix-logo.png","contentUrl":"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/d\/d9\/Postfix-logo.png"},{"@type":"BreadcrumbList","@id":"https:\/\/codedoneright.eu\/?page_id=786#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codedoneright.eu\/"},{"@type":"ListItem","position":2,"name":"Server features","item":"https:\/\/codedoneright.eu\/?page_id=483"},{"@type":"ListItem","position":3,"name":"Email server"}]},{"@type":"WebSite","@id":"https:\/\/codedoneright.eu\/#website","url":"https:\/\/codedoneright.eu\/","name":"Code Done Right!","description":"Raspberry Pi server guides","publisher":{"@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codedoneright.eu\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/50378701e349dbd5d40888bc5b532568","name":"CodeDoneRight","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/","url":"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png","contentUrl":"https:\/\/codedoneright.eu\/wp-content\/uploads\/www_icon.png","width":120,"height":120,"caption":"CodeDoneRight"},"logo":{"@id":"https:\/\/codedoneright.eu\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/codedoneright.eu"]}]}},"_links":{"self":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/786"}],"collection":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=786"}],"version-history":[{"count":45,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/786\/revisions"}],"predecessor-version":[{"id":1658,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/786\/revisions\/1658"}],"up":[{"embeddable":true,"href":"https:\/\/codedoneright.eu\/index.php?rest_route=\/wp\/v2\/pages\/483"}],"wp:attachment":[{"href":"https:\/\/codedoneright.eu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}