Email solution for self hosted website

Hi,

I have a website that at some point in the the near future will have a nodejs backend. I have thought about and most probably will transfer the site to a hosting service VPS. Whether the site is self hosted or paid hosted I still have the same issue with email. I want a service that allows me to host on a VPS or using my own server but allows a separate emailing service IMAP POP etc. I have thought about installing my own mail server but I have been warned that it is very problematic. I really need an out of the box solution. Preferably either free or cheap.

Any help would be welcome. I'm sure there must be something.

Zigs

P.S. If self hosted I need to let you know my ip is dynamic and I'm using Cloudflare as a dns updater.

Hi @ziggelflex,

to run an internet mail server, i.e. a server that accepts mails from and sends mails to the internet, you need a static IP address. DynDNS won't work.
Mailing for a domain foo.org requires the following DNS records:

The latter is not absolutely necessary, but increases trustworthiness of the mail server considerably. Most mail servers reject mails from servers with no or inconsistent PTR record.
Furthermore, at least a SPF/TXT record should be configured. This determines which hosts/networks are allowed to send as @foo.org. DKIM is also an advantage.

You can only get a static IP address from a corresponding provider. Either through your ISP or through a hoster which provides (cloud-)VMs with a static IP address. These are generally not for free.

Hey @bendingrodriguez

That makes things clearer. I’ve managed to find a VPS service that meets all those requirements but moooola (dosh) needs to be spent, around 7–8 squid (pounds) a month. I’ve got to bite the bullet and pay. I can’t do all this from home without a business ISP.

Thank you for the detailed reply.

Zigs

Sample php:

SENDSMS="emailaddress";
require_once '/u/www/swiftmailer/lib/swift_required.php';              
$transport=Swift_SmtpTransport::newInstance('smtp.postmarkapp.com',587)
        ->setUsername('xxxxxxxxxxxxxxxx')          
        ->setPassword('xxxxxxxxxxxxxxxxxxxxxxxxxxxx') ;        
$FROM[]="jack@qbol.com";                                               
$TO[]=$SENDSMS;                                                        
echo $TO;                                                              
$SUBJECT=$TWOFACTOR;                                                   
$letter="enter this number into PAYROLL verification.";                
$message = Swift_Message::newInstance()                                
       ->setSubject($SUBJECT)                                          
       ->setFrom(array($FROM ))                                        
       ->setTo(array($TO))                                             
       ->setBody($letter)                                              
       ->addPart($letter, 'text/html');                                
$mailer=Swift_Mailer::newInstance($transport);                         
$result = $mailer->send($message);                                     
unset ($TO);                                                           

I question the veracity of dynamic DNS not being able to work.

N.B. I assume that you actually mean a dynamic IP and associated DNS record dynamically updating as necessary.

I know that you can receive email at such a mail server as long as the ISP doesn't block inbound TCP port 25.

I believe that you can send email from such a mail server to many, maybe even most, but definitely not all mail servers.

My mail server would happily accept email from such a server as I don't do any filtering that would balk at such a reverse DNS host name.

There is nothing that requires that foo.org's email go to [something].foo.org.

Foo could easily publish an MX record that says email should go to client-ABC123.dynamic.ISP.example.

You should have the IP of the email server have -- what is often called -- Forward Confirmed Reverse DNS (FcRDNS).

But, ABC123.dynamic.ISP.example -> 192.0.2.1 -> ABC123.dynamic.ISP.example qualifies.

I would recommend that you configure your email server to Hello (HELO / EHLO) with the same ABC123.dynamic.ISP.example name. -- This is not a hard requirement, but I strongly recommend it.

The operative phrases are "no or inconsistent PTR record".

ABC123.dynamic.ISP.example resolving to 192.0.2.1 and
192.0.2.1 (reverse) resolving to ABC123.dynamic.ISP.example satisfies both "no" and "inconsistent" PTR record.

You can easily do both of these on a dynamic IP & name.

There are other ways to get IP addresses, but they are way outside of the scope of this discussion and almost certainly involve ASN, RIRs, and BGP.

I encourage you to spend a few minutes looking into Michael W. Lucas's new Run Your Own Mail Server book. It's coming out any day now. (The pre-release link I had is broken and I don't have a new link yet.)

Micahel's self publishing site is Tilted Windmill Press.

I don't think you should over complicate this.

An MX record simply points at an A record as the mail host.

Normally, dynamic IPs are assigned for clients, not servers which need static A records.

For example, since MX records point to A records, yes you could have some rotating IPs for A records and that would work, obviously; but it is not for guys like the original poster.

However, as the orginal poster described it, it is really better to get a static IP assigned. Making things complicated just "because we can" is not good network engineering. especially for people who are not experts.

Sorry @DrScriptt, but please keep it real. You are way out of scope of the simplicity of the original posters question.

We are not competing here for who can sound the smartest and drop the most phrases. The OP is not interested in BGP, for goodness sake :slight_smile:

Please keep it simple based on the original post.

Thanks.

Thanks to all,

With the research I’ve done so far and all the replies to (what seems like contentious subject) I’ve decided to do this with a provider. Yes @neo I am no expert or even a professional in this matter but I still have this underlying urge to do all of this myself … so even though at this point I will need to rely on a paid service, this hopefully won’t be the case in the future. So I say once again thanks … and when that book is published @DrScriptt I may purchase it.

Ziggy :grin:

I am not really understanding you @ziggelflex, sorry.

For example, I have over 4 decades of experience working with networking; and I have many paid services including dedicated servers and dedicated services.

All of these services have static IP addresses assigned.

It's not a matter of "not being an expert or not", it is a matter of keeping solutions simple because the more simple a solution is, the less time it takes to debug it and the less headache.

When people stack layer upon layer of technolocy to accomplish simple tasks they are not doing themselves any favors. Things break and the simpler the solution, the faster it is debugged. There are less security holes possible, etc.

It you want to host your own email server just get a low cost VPS and learn to configure it. I think LINODE has VPS for as low as $5 a month. If you need more power, memory, cpu, etc you can just upgrade.

If you want reliable email for beginners with POP and IMAP services consider GMAIL.

If you want experience building email services, use a VPS with a static IP address.

:slight_smile: