
MTAs generally operate in two different modes: (1) They will relay messages from authenticated users to remote hosts, and (2) they will receive messages from remote hosts to its users and store them somehow. An MTA will typically act as an SMTP server to receive messages, and then it will act as an SMTP client when it relays the messages to remote hosts. It sounds like you want to run a mail transfer agent (MTA) that relays email to remote SMTP servers. That didn't seem to be the case, and I'm not sure why.Įxact repro steps, where is my domain, and terminals are running on a box with a hostname listed in my MX records. does the SMTP server need to authenticate to say, the gmail SMTP server as a user in order to send mails over there? That seems weird, since it's not a user logging into gmail to send mails, it's an SMTP server that is authorized within SPF sending mail from my domain ( From address from my domain as well) to where ever the app server user's email is based (in this example, the user would be e.g., tried using python's aiosmtpd command-line and telnet to send a mail from to and it didn't seem to deliver the message I figured aiosmtpd would connect to the preferred MX servers for my domain (my "real" MX's) to transfer the message, which would then put it in my inbox. I figure since I'm running my own SMTP server, that I don't really need to authenticate against it (it's running on localhost), just take in any mail and send it on to recipient domains. Then, I can have that same host run a super lightweight SMTP server that can accept mails from the application, and send them on to recipients.Īlmost crucially, I want this server to basically just run on localhost so that only this application can connect and send mails through it, but so that it can't really "receive" mails sent to my domain (I have set the MX priority very low (well, a high number) for this app server). I figure, since I'm using my own domain, I have SPF/DKIM/DMARC configured, I can add an MX record for the host I set the application up on (my SPF record has the mx keyword to authorize any hosts in my MX records to send/receive mails). To explain, I'm trying to setup an application which sends notifications to users by connecting to an SMTP server. I can't seem to find a good explanation of what is happening behind the scenes and I think this is preventing me from being able to do what I am attempting to do.


Honestly, I think I have a fundamental gap in understanding how SMTP works.
