How can I send email directly * using the SMTP protocol? (MTA bypass at my end)

I need to send DIRECLTY email to the recipient's mail server, bypassing any MTA at my end. I know that there are several reasons to use MTA, such as sendmail, etc., Therefore, I do not need advice in this direction. I would like to write code that connects directly to the recipient's mail servers.

So, am I missing something here?

  • Suppose the recipient’s email address is user@domain.com
  • Look at the MX records for the .com domain and select a random MX record. We will call this "server"
  • If there is no MX record for the .com domain, use "domain.com" as the "server"
  • Connect to the “server” in port 25.
  • Pass this:

HELO myserver.com
MAIL FROM: < me@myserver.com >
RCPT TO: < user@domain.com >
DATA
Subject: This is a test

Hello, this is a test message.

LOG OFF

This has worked in many cases. I wonder what I am missing? Are there any cases where this will not work and I need to do something more special?

Can I check it as we go - if the remote server I'm connecting to says “MESSAGE ACCEPTED FOR DELIVERY”, can I assume that it will go through?

+3
source share
2

, , , , , , .

MX, , , , . -, , , , .

, MX , , . , -, .

-, MX, , . MX, .

ESMTP (EHLO .), , , . , , , , - !

greylisting. , , greylisting, , . MX.

, , , -, , . , DNS HELO , .

+4

Source: https://habr.com/ru/post/1722180/


All Articles