Posted by Dave on

My little mail server

My little mail server

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’s try and bring up an SMTP server, connect it to DNS, and then send them myself.

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 ‘Pi.

Is it worth it?

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 Runbox as his provider now. Can this be made to do what I want?

Raspberry Pi

I returned to this in Nov 2022 and found these resources, as I turned my attention to Raspberry Pi and away from Amazon, it’s too expensive for a hobbyist. My use case is now a low volume activity.

I chose postfix as my mail tool[s]

Postfix

  1. Setting it up
    1. How to setup email alerts on linux using gmail from “How to Geek”, they use ssmtp. This article has a diagram, and includes dovecot on its solution & How to set up a mail server on your Raspberry Pi? from Raspberry Tips,  which uses postfix. <== 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 are chargeable.
    2. As I worked my way through this, I came across a series of articles by Linux Babe, starting with  Build Your Own Email Server on Ubuntu: Basic Postfix Setup which deals with the install and DNS configuration.
    3. On my way, I decided to use postfix to install the mail utilities, a note on the alternatives, see also these links, which describe how to use mail.
      1. Send email from Linux CLI from edmdesigner, majors on sendmail and a series of unusual mail clients although includes mailx and Using mail to-read email from command line from Stack Exchange, see also https://www.binarytides.com on linux mail command-examples and how to delete mail messages using mail.
      2. On postfix mail storage files details file locations the mail boxes are held in /var/mail. There are two storage regimes, known as Maildir or mbox. Postfix default is mbox.
      3. How to install mail utils via apt, the apt runes, but here’s its config man page and q=how+to+configure+mailutils and here is the man page for mail
  2. Making it work
    1. These two links suggest that postfix & DNS maybe enough, from O’Reilly ,Postfix: The Definitive Guide by Kyle D. Dent, and Kiero Connect, Essential DNS Records for Mail Delivery and Spam Protection, it seems they are.
    2. See also, postfix from archlinux.org which includes details on checking the config.
    3. I was unclear if postfix needed any help to reach its destination. I was confused by lessons of the past from the 90’s when using mail often meant you had to give the mail system route hints, but,
    4. No routing intermediaries are needed, postfix and the responder both use DNS. We’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 note on SPF and DKIM at linuxbabe. The SPF tests requires a reverse lookup DNS record which noip do not support, or do not support on change of address. Thus I need to consider using a different DNS provider or mail solution.

I suspect I have not finished with postfix and mail dispatch. I am concerned about receiving mail bombs, this talks about postfix’s message size parameter, there are more, but I think that it has a series of parameters to restrict size and maybe flow, this also refers. The config parameters are documented here. But I suspect that SPF and DKIM may be useful here.

I need another plan; I investigate dovecot. The plan is to use mail to distribute the mail and dovecot to allow people to come and get it. For dovecot I read and used, how to install-dovecot on ubuntu-20-04, I might also need set-up-a-postfix-mail-server-with-dovecot-and-squirrelmail-on-ubuntu/ from ionos; its documentation of the smtp is better. Mutt is recommended as a mail tool.

This all goes on easily enough, but it seems there are two storage regimes. I either have a mismatch or I have an addressing problem. i.e. either the imap server can’t find the mail, or my test browser’s can’t find the imap server. I suspect the former. What I found,

Mailgun

I had been pointed at mailgun by one of the mastadon installs. It’s not so well reviewed well in the article above. This describes how to use Mailgun as an smtp server for gmail and hotmail accounts.

I found some additional resources about mailgun.

  1.  Their pricing page, looking for the free one
  2. A how to get started at Rec & Rec+
  3. Jeff Reifmann on getting started too
  4. and they have a video, getting started with Mailgun, a video, which I have not yet watched.

In Feb ’18, I read up about Amazon & DNS and then I found this on mail & EC2. And then I found this, 7 Best Transactional Email Services: Sendgrid vs. Mandrill & More. I was also pointed at Runbox.


Comments ( 12 )

  1. Dave
    More about Mailgun
  2. Raspberry Pi and messages |
    […] See my little mail server […]
  3. Dave
    I added the link to the Raspberry Pi today.
  4. Diaspora |
    […] My little mail server […]
  5. Raspbian on Virtual Box – davelevy . info / wiki
    […] https://raspberrytips.com/mail-server-raspberry-pi/ , https://davelevy.info/wiki/my-little-mail-server/ which points at […]
  6. Raspberry Pi III – davelevy . info / wiki
    […] and send a message between root and dave using mail. So mailutils is on the machine. See also https://davelevy.info/wiki/my-little-mail-server/. The next phase on mail involves installing on the real machine, working out the smtp relay and the […]
  7. Dave
    I have read and described the links in the Raspberry Pi section. I have postfix running on a dev system, and can send mails between users. Do I need mail relay? Do I need permission for a mail relay, or can I get the destination address from DNS? Is NOIP actually the simplest answer?
  8. Dave

    I returned to my postfix server. I mailed my ionos account and received a 554 error. I amended the /etc/mailname record, I checked the main.cf and set the myhostname parameter.

    I set up an MX record on the NOIP site. This may not yet have propagated. I also sent a message to myself at google mail.

    The error log messages still identify the sending system as ‘raspberry’ which is the result of `hostname` command.

    The error log messages are here.

    Here is the ionos error message page , which also may point at an SMTP error which is actually a DNS/PTR/SPF error. The google error message page is here and refers to Reverse_DNS_lookup and/or SPF/DKIM, this page refers to SPF/DKIM

    The good news is that the mails are getting there and returning error messages; the bad news obviously is that they are being rejected.

    Two problems, the receivers think it’s coming from raspberry which they can’t see on reverse lookup, so it’s either an identity declaration, or a DNS error; the google error message is more explicit; I need an SPF/DKIM setting.

  9. Dave
    This seems a blind alley, There's lots of advice on using google as a mail relay, including this, from google; I am confused if you need a google workspace account and if that is free to google mail users. See also, How to use google's smtp server, this seems to be an "in the box" solution, although it points to how to configure postfix as a send only smtp server. Also the Rasperrytips article does not document getting permission to use a relay, however NOIP also offer to Setup Alternate-Port SMTP. Is this what I need? No! I need more DNS records for which they charge. Also Route outgoing SMTP relay messages through Google from Google; which led me to this q="how to open a google admin account, most of which seem to be about how to login, but as I said above mashable suggests its now free to google mail users, but not the route I am taking.
  10. Dave
    I added the comments about whether it's worth it to host the mail boxes? And whether NOIP will dynamically maintain the SPF records. They don't.
  11. Dave
    I removed these words. "How to set up a simple mail server on Debian in 5 easy stepsfrom Clement Nedelcu's Development Journal, uses postfix and saslauthd and dovecot for pop and imap. This is dated 2014 and is version 1, it claims not to be forward compatible.
  12. Dave

    No routing intermediaries are needed, postfix and the responder both use DNS. We'll see.

    Postfix

    I am in a position where I can send mail out of my servers, but they are rejected with SPF or DKIM errors. Here is a note on SPF and DKIM at linuxbabe. The SPF tests requires a reverse lookup DNS record which noip do not support, or do not support on change of address. Thus I need to consider using a different DNS provider or mail solution.

    SMTP and phantom routing

    Postfix does not need any route hints. These links were found when I thought it did. Route outgoing SMTP relay messages through Google from Google; which led me to this q="how to open a google admin account", most of which seem to be about how to login, but as I said above mashable suggests it’s now free to google mail users.

    Sending smtp email using raspberry pi, pretty basic on the server, also uses google as the mail browser. This might be useful when I finally expose the mailboxes.

    I found the following links using google

    1. 1. http://www.howtogeek.com/51819/how-to-setup-email-alerts-on-linux-using-gmail/, this is very simple, wonder if it does what I want?
    2. 2. Sending Emails? Send them from Linux Terminal , I was looking for instructions in how to use 'mail'
    3. How to set up simple mail server on debian-linux

    This was removed from the main article today.

This site uses Akismet to reduce spam. Learn how your comment data is processed.