Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Advertise on LowEndTalk.com
Receive incoming mail (not sending) - terminology help
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

Receive incoming mail (not sending) - terminology help

sacovesacove Member

Hi all

I am looking for a way to receive incoming mail on an ubuntu vm (Hetzner) and pipe it to a script / dump it in a folder / sql database, for reading from app code.
So email can be sent (from third parties) to [email protected], and i can read it from code.

The ultimate aim being to create something similar to a self hosted disposable email service.

Now i can google for a solution, and blindly follow a tutorial (usually using postfix) but i could really do with some pointers to what does what, so im not just crossing my fingers and hoping for the best.

1st things first - what type of server am i looking to create? At first i thought pop3/imap, but on further reading i think that refers to the server that allows mail clients(eg thunderbird) to read emails from the server. Then i thought SMTP, but that seems to be the code that receives messages from a mail client (eg thunderbird), and sends them out.

So what is the server that receives email from the wider internet called?

2nd, once i know what the thing is called (lets call in IncomingMailServer for now), how do i configure DNS to point to my vm?
I already have an A record pointing example.com to my vm's public IP address (and have nginx listening on port 80 to server html), do i just add an mx record pointing to example.com and have IncomingMailServer listen on a certain port? Or is there more to it?

Any help appreciated.

Comments

  • SmallWebSmallWeb Member, Provider

    sacove said: So what is the server that receives email from the wider internet called?

    I would think "mail server" covers it. A server, with installed mail packages and protocols.

    sacove said: I already have an A record pointing example.com to my vm's public IP address (and have nginx listening on port 80 to server html), do i just add an mx record pointing to example.com and have IncomingMailServer listen on a certain port? Or is there more to it?

    You may also want to look into SPF and DKIM records, typically as text records.

    Thanked by 1sacove
  • FalzoFalzo Member

    sacove said: So what is the server that receives email from the wider internet called?

    what you are searching for is your SMTP server.

    sacove said: Then i thought SMTP, but that seems to be the code that receives messages from a mail client (eg thunderbird), and sends them out.

    SMTP is neither a server nor code. but a protocol, as the name says ;-)

    however, implying you mean some SMTP server software (like the mentioned postfix) I'd say technically it does neither receive nor send, but just relay.

    mail is transported from a source (f.i. a mail client app) to a destination (usually a mailfolder on some harddrive) via relays. simple mail transport protocol is used for that.

    that's why your SMTP server can do both. accepting mail from your mail client (or webserver etc.) and relay it into the internet (another smtp server that is) - or transport mail that comes in from the internet into your local inbox.

    as you correctly figured already with software that implement pop3 or imap protocols you can manage your inbox and the mails within after that.

    TL;DR;

    @Mic-hael said:

    sacove said: So what is the server that receives email from the wider internet called?

    I would think "mail server" covers it. A server, with installed mail packages and protocols.

    UltraVPS.eu KVM in US/UK/NL/DE: 15% off first 6 month | Netcup VPS/rootDS - 5€ off: 36nc15279180197 (ref)

  • Thanks @Falzo that's really helpful.
    Specifically, the information about SMTP protocol.

    I hate doing anything in code without a clear mental overview of how it should work, and it seems most tutorials on email only cover the HOW, not the WHY.

    Thanked by 1Falzo
  • chihcherngchihcherng Member
    edited January 25

    sacove said: So what is the server that receives email from the wider internet called?

    An SMTP server, or in DNS terms, Mail Exchange (the MX record).

    sacove said: 2nd, once i know what the thing is called (lets call in IncomingMailServer for now), how do i configure DNS to point to my vm?
    I already have an A record pointing example.com to my vm's public IP address (and have nginx listening on port 80 to server html), do i just add an mx record pointing to example.com and have IncomingMailServer listen on a certain port? Or is there more to it?

    When someone sends email to [email protected], his SMTP server will first look up the MX of example.com. The MX has to be a domain name, not an IP address. So you should configure the MX of example.com as "example.com", the domain name for your VM. Your server will listen on TCP port 25, which is reserved for SMTP. So the sending SMTP server will connect to TCP port 25 of your VM and send that email to your SMTP server.

    Thanked by 2sacove uptime

  • uptimeuptime Member
    edited January 25
Sign In or Register to comment.