Mailserver on Glitch (receiving)

javascript

#1

I am currently attempting to run a mail server to receive email on my Glitch project, I don’t know exactly how to configure my DNS (on CloudFlare) to send mail to my Glitch project, what records do I need to setup, and does Glitch allow mail requests?

I am using mailin to set my mail server up.

My example project: jet-taste


#2

Hey @Consoli0 this is unlikely to work as you’d like it to because your project won’t be accessible over any external port aside from 80 and 443. Other mail servers will be expecting to connect to it over port 25 (the standard SMTP port), so even if you were to proxy requests to mailin running on the standard internal port that Glitch opens, external mail servers won’t be able to communicate with it.


#3

Ah makes sense @cori, I was getting EACCESS errors when attempting to use mailin.

I wonder, is it possible for me to set a record to point to a certain port that I do have access to listen on?


#4

Hey @Consoli0, that’s expected behavior. mailin will try to use port 25 by default, and you need to be the root user to listen to any port below around 1000, since they’re well-known ports for specific services. Your Glitch project doesn’t run under the root credentials so aside from the fact that we only open a single local port it can’t listen to port 25. If you set it to listen to the port we open, then if your project was using Node on that port you’d get an EADDRINUSE error instead.

Unfortunately DNS doesn’t really work that way - at its simplest it’s basically just a phone book for IP addresses, so setting a record to point to your Glitch project will tell the rest of the internet where to find it, but not what port to use - that’s dependant on the application doing the work. The difference between an A record and an MX record is sort of like the difference between your cell phone number and your home number, if you have both.

What you could do here is to write a little node code to poll an external email address that you used just for your project, and have whatever you were expecting to send you emails to use that address. So you could set up consolios-cool-project@gmail.com and have your project connect to GMail (or the provider of your choice) and retrieve the email from that mailbox. You could also look into something like https://www.cloudmailin.com, which accepts email on your behalf and forwards it to your Node app for processing.

Hope this helps!


#6

Cloudmailin has been a great help!
My current route is:
blobble.tk>CloudFlare>ImprovMX>Cloudmailin>My project,
thanks @cori


#7

Glad you were able to work something out! Happy Glitching!