{"id":2639,"date":"2015-04-17T10:22:22","date_gmt":"2015-04-17T10:22:22","guid":{"rendered":"http:\/\/wiki.davelevy.info\/?p=2639"},"modified":"2025-05-27T09:34:26","modified_gmt":"2025-05-27T09:34:26","slug":"my-little-mail-server","status":"publish","type":"post","link":"https:\/\/davelevy.info\/wiki\/my-little-mail-server\/","title":{"rendered":"My little mail server"},"content":{"rendered":"\n<p>What a pile of poo! I have access to four smtp servers and they all have limits on the distribution list size! (They are all about the same size of 100). Google will allow 2000 per list but only if you use one of their clients. Let&#8217;s try and bring up an SMTP server, connect it to DNS, and then send them myself.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>This page was started in 2016 when I was interested in sending large circulation news letters. I became interested again when I felt I wanted to host some services on my &#8216;Pi.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Is it worth it?<\/h3>\n\n\n\n<p>i.e. making postfix\/exim work; a good friend tried running his mail server\/service from home and found that keeping up with anti-spam\/encryption technology was a lot of work calling on expertise at the edge of his interest. He uses <a href=\"https:\/\/runbox.com\/\">Runbox<\/a> as his provider now. Can this be made to do what I want?<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Raspberry Pi<\/h3>\n\n\n\n<p>I returned to this in Nov 2022 and found these resources, as I turned my attention to Raspberry Pi and away from Amazon, it&#8217;s too expensive for a hobbyist. My use case is now a low volume activity. <\/p>\n\n\n\n<p>I chose postfix as my mail tool[s]<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Postfix<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Setting it up\n<ol style=\"list-style-type:lower-roman\" class=\"wp-block-list\">\n<li><a href=\"https:\/\/www.howtogeek.com\/51819\/how-to-setup-email-alerts-on-linux-using-gmail\/\">How to setup email alerts on linux using gmail<\/a>&nbsp;from \u201cHow to Geek\u201d, they use <code>ssmtp<\/code>. This article has a diagram, and includes dovecot on its solution &amp; <a href=\"https:\/\/raspberrytips.com\/mail-server-raspberry-pi\/\">How to set up a mail server on your Raspberry Pi?<\/a>&nbsp;from Raspberry Tips,&nbsp; which uses <code>postfix<\/code>. &lt;== This looks like the best. I use NOIP to obtain a DNS address, and will need to use it to set the MX record, however, additional TXT records including the RARP record are chargeable.<\/li>\n\n\n\n<li>As I worked my way through this, I came across a series of articles by Linux Babe, starting with&nbsp; <a href=\"https:\/\/www.linuxbabe.com\/mail-server\/setup-basic-postfix-mail-sever-ubuntu\">Build Your Own Email Server on Ubuntu: Basic Postfix Setup<\/a>&nbsp;which deals with the install and DNS configuration.<\/li>\n\n\n\n<li><a href=\"https:\/\/forums.raspberrypi.com\/viewtopic.php?t=210084\">Simple Email Configuration on a Raspberry Pi<\/a> from the Raspberry Pi forums<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Making it work\n<ol style=\"list-style-type:lower-roman\" class=\"wp-block-list\">\n<li>These two links suggest that postfix &amp; DNS maybe enough, from <a href=\"https:\/\/www.oreilly.com\/library\/view\/postfix-the-definitive\/0596002122\/ch06s03.html\">O&#8217;Reilly ,Postfix: The Definitive Guide by Kyle D. Dent,<\/a> and Kiero Connect, <a href=\"https:\/\/manuals.gfi.com\/en\/kerio\/connect\/content\/server-configuration\/mail-delivery-and-dns-records\/essential-dns-records-for-mail-delivery-and-spam-protection-1223.html\">Essential DNS Records for Mail Delivery and Spam Protection<\/a>, it seems they are.<\/li>\n\n\n\n<li>See also, <a href=\"https:\/\/wiki.archlinux.org\/title\/postfix\">postfix<\/a> from archlinux.org which includes details on checking the config.<\/li>\n\n\n\n<li>I was pointed at <a href=\"https:\/\/medium.com\/20ms\/configuring-ssl-tls-for-postfix-5c87cb54aa89\">https:\/\/medium.com\/20ms\/configuring-ssl-tls-for-postfix-5c87cb54aa89<\/a> which documents installing ssl on Centos. <\/li>\n\n\n\n<li>No routing intermediaries are needed, postfix and the responder both use DNS.  We&#8217;ll see. I have now sent  mail out of my servers, but they are rejected by the target servers with SPF or DKIM errors. A <a href=\"https:\/\/www.linuxbabe.com\/mail-server\/setting-up-dkim-and-spf\">note on SPF and DKIM<\/a> at linuxbabe. The SPF tests requires a reverse lookup DNS record which <em>noip<\/em> do <strong>not <\/strong>support, or do not support on change of address. Thus I need to consider using a different DNS provider or mail solution. <\/li>\n<\/ol>\n<\/li>\n<\/ol>\n\n\n\n<p>I moved my notes on the mail utilities to this modal.<\/p>\n\n\n\n<style>\n\/* this block will support three modals, but only one is used today 4\/5\/2023 *\/\nbutton {width: 230px; text-align:center}\n\n.modal {\n    display: none; \/* Hidden by default *\/\n    position: fixed; \/* Stay in place *\/ z-index: 1; \/* Sit on top *\/\n    left: 0; top: 0;  padding-top: 100px; \/* Location of the box *\/\n    width: 80%; \/* Full width *\/ \n   overflow: auto; \/* Enable scroll if needed *\/\n    background-color: rgb(0,0,0); \/* Fallback color *\/\n    background-color: rgba(0,0,0,0.4); \/* Black w\/ opacity *\/}\n        \n\/* Modal Content *\/\n.modal-content { background-color: #fefefe; margin: 5px; font-size: 80%; padding: 5px; width: 95%; border: 1px solid #888; }      \n\/* The Close Button *\/\n.close { color: #aaaaaa; float: right; font-size: 28px; font-weight: bold; }    \n.close:hover, .close:focus { color: #000; text-decoration: none; cursor: pointer; }\n    \n.modal-content2 {\n    background-color: #fefefe; margin: auto; padding: 20px; border: 1px solid #888;\n    width: 95%; }\n.close2 { color: #aaaaaa; float: right; font-size: 28px; font-weight: bold; }\n.close2:hover, .close2:focus { color: #000; text-decoration: none;cursor: pointer; }\n\n.modal-content3 { background-color: #fefefe; margin: auto; padding: 20px; border: 1px solid #888; height: 100%;\n    width: 95%; }\n.close3 { color: #aaaaaa; float: right; font-size: 28px; font-weight: bold; }\n.close3:hover, .close2:focus { color: #000; text-decoration: none;cursor: pointer; }\n\n.scroll-box { width: 650px; \/* maximum width of the box, feel free to change this! *\/ overflow-x: scroll; white-space: nowrap;     }\n<\/style>\n\n\n\n<button id=\"myBtn\">Mailutils &amp; the CLI<\/button>\n<div id=\"myModal\" class=\"modal\">\n<!-- Modal content -->\n<div class=\"modal-content\">\n<p><span class=\"close\">\u00d7<\/span><\/p>\n<p style=\"font-size: 120%;\">&nbsp;&nbsp;M a i l u t i l s&nbsp;&nbsp;and the C L I<\/p>\n<p style=\"font-size: 102%;\">Having decided to use postfix to install the mail utilities, I found a<a href=\"https:\/\/www.baeldung.com\/linux\/php-get-installed-extensions\">note on the alternatives<\/a>, see also below for more links, which describe how to use the <code><strong>mail<\/strong><\/code> program.\n<\/p><ol type=\"a\">\n    <li>An article called, <a title=\"from edmdesigner\" href=\"https:\/\/blog.edmdesigner.com\/send-email-from-linux-command-line\/\">Send email from Linux CLI<\/a> which majors on <code><strong>sendmail<\/strong><\/code> and a series of less usual mail clients although it mentions <code><strong>mailx<\/strong><\/code>. There is also <a title=\"from Stack Exchange\" href=\"https:\/\/unix.stackexchange.com\/questions\/239380\/use-mail-to-read-email-from-command-line\">Using mail to-read email from command line<\/a>. See&nbsp;also <a href=\"https:\/\/www.binarytides.com\/linux-mail-command-examples\/\">https:\/\/www.binarytides.com on linux mail command-examples<\/a>&nbsp;and <a href=\"https:\/\/apple.stackexchange.com\/questions\/28745\/how-do-i-delete-all-terminal-mail\">how to delete mail messages<\/a> using <code>mail<\/code>.<\/li>\n    <li>This article on <a href=\"https:\/\/superuser.com\/questions\/395922\/postfix-mail-storage-files\">postfix mail storage files<\/a> and details file locations and that the default config, the mail boxes are held in \/var\/mail. There are two storage regimes, known as Maildir or mbox. Postfix default is mbox.<\/li>\n    <li>Finally we have, <a href=\"https:\/\/zoomadmin.com\/HowToInstall\/UbuntuPackage\/mailutils\">How to install mail utils via apt<\/a>, which document the apt runes, but here&#8217;s its <a href=\"https:\/\/ftp.gnu.org\/old-gnu\/Manuals\/mailutils-0.2\/html_node\/configuration.html\">config man<\/a> page and a google query, <a href=\"https:\/\/www.google.com\/search?q=how+to+configure+mailutils\">how to configure mailutils<\/a>&nbsp;and here is the <a href=\"https:\/\/linux.die.net\/man\/1\/mail\">man page for mail<\/a><\/li>    \n<\/ol>\n<p><\/p>\n<\/div>\n<\/div>\n\n\n\n<script>\n\/\/ Get the modal  \nfunction showmodal (id,bid, cid) {\n\n    var modal = document.querySelector(id);\n    var btn = document.querySelector(bid);\n    var span = document.querySelector(cid);\n\n    btn.addEventListener(\"click\", function () {\n        modal.style.display = \"block\";\n    });\n\n    span.onclick = function () { modal.style.display = \"none\"; }\n    \/\/ When the user clicks anywhere outside of the modal, close it\n    window.addEventListener(\"click\", function (event) {\n        \/\/console.log(event.target);\n        if (event.target == modal) {\n            modal.style.display = \"none\";\n        }\n    });\n}\n<\/script>\n\n<script>\nshowmodal(\"#myModal\",\"#myBtn\",\".close\"); \nshowmodal(\"#myModal2\",\"#myBtn2\",\".close2\");\nshowmodal(\"#myModal3\",\"#myBtn3\",\".close3\");\n<\/script>\n\n\n\n<p>I suspect I have not finished with postfix and mail dispatch. I am concerned about receiving mail bombs, this talks about <a href=\"https:\/\/serverfault.com\/questions\/327416\/changing-the-maximum-mail-size-in-postfix\">postfix&#8217;s message size parameter<\/a>, there are more, but I think that it has a series of parameters to restrict size and maybe flow, this <a href=\"https:\/\/serverfault.com\/questions\/327416\/changing-the-maximum-mail-size-in-postfix\">also refers<\/a>. The <a href=\"https:\/\/www.postfix.org\/postconf.5.html\">config parameters are documented here<\/a>. But I suspect that SPF and DKIM may be useful here.<\/p>\n\n\n\n<p>I need to consider <a href=\"https:\/\/web.archive.org\/web\/20240414150937\/https:\/\/linux-audit.com\/postfix-hardening-guide-for-security-and-privacy\/\">hardening <\/a>postfix and may need to<a href=\"https:\/\/workaround.org\/ispmail\/jessie\/create-certificate\"> make a custom certificate<\/a> or <a href=\"https:\/\/help.runbox.com\/enabling-encryption-smtp-service\/\">this<\/a>, from Runbox.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Dovecot and Mutt<\/h4>\n\n\n\n<p>I need another plan; I investigate <em>dovecot<\/em>. The plan is to use <em>mail <\/em>to distribute the mail and <em>dovecot <\/em>to allow people to come and get it. For <em>dovecot <\/em>I read and used, <a href=\"https:\/\/tecadmin.net\/install-dovecot-ubuntu-20-04\/\">how to install-dovecot on ubuntu-20-04<\/a>, I might also need <a href=\"https:\/\/www.ionos.co.uk\/digitalguide\/e-mail\/technical-matters\/set-up-a-postfix-mail-server-with-dovecot-and-squirrelmail-on-ubuntu\/\">set-up-a-postfix-mail-server-with-dovecot-and-squirrelmail-on-ubuntu\/<\/a> from ionos; its documentation of the <em>smtp <\/em>is better. <a href=\"https:\/\/www.tecmint.com\/send-mail-from-command-line-using-mutt-command\/\">Mutt<\/a> is recommended as a mail tool. It takes a -f parameter for the mail file and takes a file scheme argument too. So mutt -f imaps:\/\/user@mailhost. <\/p>\n\n\n\n<p>This all goes on easily enough, but it seems there are two storage regimes for UNIX mail. The comment dated 9th April refers. <em>Dovecot <\/em>in 2023 seems to work it out. <\/p>\n\n\n\n<p>I used the certs I bought from NOIP to identify dovecot, and use thunderbird to link to myuser@mydnsname, I had to revise the user name which was generated to username only. imaps is port 993, and smtp is 587 (i think). I needed to make a firewall rule for imaps for the <strong>hub <\/strong>and used the provided smtp rule. The home hub interface is as shit as ever. <\/p>\n\n\n\n<p>I  was thinking about how to manage the mailboxes for remote users and came across this articles <a href=\"https:\/\/www.linuxquestions.org\/questions\/linux-newbie-8\/add-user-account-to-linux-using-a-webpage-4175469948\/\">add user account to linux using a webpage<\/a> which recommends LDAP  which I <a href=\"https:\/\/davelevy.info\/wiki\/openldap\/\">last looked at a long time ago<\/a> and using users without logins and home directories. Basically I need to look at the apps I plan to use.  <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Mailgun<\/h3>\n\n\n\n<p>I had been pointed at <a href=\"https:\/\/www.mailgun.com\">mailgun <\/a>by one of the <a href=\"https:\/\/davelevy.info\/wiki\/mastodon\/\">mastadon installs<\/a>. It&#8217;s not so well reviewed well in the article above. This describes <a href=\"https:\/\/youtu.be\/iNW2OZT_fPs\">how to use Mailgun as an smtp server for gmail and hotmail<\/a> accounts.<\/p>\n\n\n\n<p>I found some additional resources about mailgun.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>&nbsp;<a href=\"https:\/\/www.mailgun.com\/pricing\">Their pricing page<\/a>, looking for the free one<\/li>\n\n\n\n<li>A how to <a href=\"http:\/\/support.reallyeasycart.co.uk\/support\/solutions\/articles\/227642-setting-up-smtp-or-mailgun-aws-as-your-email-sending-provider\">get started<\/a> at Rec &amp; Rec+<\/li>\n\n\n\n<li><a href=\"https:\/\/jeffreifman.com\/how-to-install-your-own-private-e-mail-server-in-the-amazon-cloud-aws\/configure-mailgun\/\">Jeff Reifmann on getting started<\/a> too<\/li>\n\n\n\n<li>and they have a video, <a href=\"https:\/\/youtu.be\/p4sGlrrWzj4\">getting started with Mailgun<\/a>, a video, which I have not yet watched.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>In Feb &#8217;18, I read up about <a href=\"https:\/\/davelevy.info\/wiki\/route-53-on-aws\/\">Amazon &amp; DNS<\/a> and then I found <a href=\"https:\/\/forums.aws.amazon.com\/message.jspa?messageID=317525\">this on mail &amp; EC2<\/a>. And then I found this, <a href=\"https:\/\/www.ventureharbour.com\/transactional-email-service-best-mandrill-vs-sendgrid-vs-mailjet\/\">7 Best Transactional Email Services: Sendgrid vs. Mandrill &amp; More<\/a>. I was also pointed at <a href=\"https:\/\/runbox.com\/\">Runbox<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What a pile of poo! I have access to four smtp servers and they all have limits on the distribution list size! (They are all about the same size of 100). Google will allow 2000 per list but only if you use one of their clients. Let&#8217;s try and bring up an SMTP server, connect&#8230;<\/p>\n","protected":false},"author":1,"featured_media":6833,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","_share_on_mastodon":"0"},"categories":[27,3],"tags":[159,122,114,51,1186,994,1286,387,920,911],"class_list":["post-2639","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","category-technology","tag-aws","tag-dns","tag-google","tag-mail","tag-mailgun","tag-raspberry-pi","tag-raspbian","tag-smtp","tag-software","tag-technology"],"share_on_mastodon":{"url":"https:\/\/mastodon.social\/@davelevy_eu\/112083923905327450","error":""},"jetpack_featured_media_url":"https:\/\/davelevy.info\/wiki\/wp-content\/uploads\/2015\/04\/danish-postbox-CC-dfl-bysa-2014-w1024-cropped.png","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/2639","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/comments?post=2639"}],"version-history":[{"count":21,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/2639\/revisions"}],"predecessor-version":[{"id":12424,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/posts\/2639\/revisions\/12424"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/media\/6833"}],"wp:attachment":[{"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/media?parent=2639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/categories?post=2639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davelevy.info\/wiki\/wp-json\/wp\/v2\/tags?post=2639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}