Содержание

SMTP gate

What is an SMTP gate

SMTP-gate is a way to send us jobs to send emails via the SMTP protocol. The difference between API and SMTP is the data transfer protocol used: SMTP or HTTP protocol. With the SMTP protocol, a sequence of commands is used to send to the server.

enKod supports:

Authorisation and sending a message

The enKod authentication is done using SMTP keys. Obtain an SMTP key from your personal SMTP manager to use the SMTP gateway.

Connect to the SMTP server at address: smtpgateway.enkod.io:587

Use the following command sequence:

Example of a request to send via openssl

s_client -starttls smtp -connect smtpgateway.enkod.ru:587
ehlo testmail.ru
auth plain AABfN3lhTUZtcm5hZ251VFRXR1lueVNiQWNLX2R4VTh4WWVYdzV2UzBYXVpMQ==
mail from:test@testmail.ru
rcpt to:test2@testmail.ru
data
Date: Thu, 29 Sep 2022 15:42:13 GMT
From: test@testmail.ru
To: test2@testmail.ru
Subject: subject
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office" style="font-family:'open sans', 'helvetica neue', helvetica, arial, sans-serif">
<head>
<meta charset="UTF-8"/>
<meta content="width=device-width, initial-scale=1" name="viewport"/>
<meta name="x-apple-disable-message-reformatting"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta content="telephone=no" name="format-detection"/>
<title>title</title><!--[if (mso 16)]>
<style type="text/css">
a {text-decoration: none;}
</head>
<html>
<body>
message body
</body>
</html>

Features of displaying message subjects and senders

Yandex has updated its rules for processing email subjects:

You can use the following structure: =?charset?encoding?encoded-text?=

For example, send the subject as:

Subject: =?utf-8?B?0KLQtdGB0YIgU01UUCDlhbzQvNC+0LQ=?=

If the address in the From field is not formed using the RFC standard, it will be marked as EMPTY-FROM. The email properties will also contain From: EMPTY-FROM.

Possible errors

Message sending process

Request → enKod → Receiving mail server

Step 1. enKod checks the received request (whether the API key is valid, whether the specified email addresses are valid, etc.).

Step 2. enKod attempts to contact the mail server.

The final delivery status depends on many factors (the sender's domain reputation, the existence of the recipient's mailbox, etc.). Additionally, the receiving mail server may ask to send the email later — for this, we use our own forwarding mechanism. This process can take a long time, so in order not to delay the response, enKod performs initial checks in step 1 and responds that everything worked correctly.

After the letter has been sent, we do not immediately return the error that occurred on the mail server side. Because of this, the request may be processed successfully, but the error will be reflected in the statistics.

To get information about the final delivery status of a message, you can configure Webhooks.