Email
SMTP specification

SMTP specification

Simple Mail Transfer Protocol (SMTP) is a communication protocol that enables the safe and reliable exchange of email messages from one user to another. Infobip provides an SMTP server for the secure delivery of emails.

The Infobip SMTP API behaves in the same way as any SMTP-compliant server, for example, your ISP, Gmail, or your corporate email server. This means that you can configure any email provider, such as Outlook or Thunderbird, to use Infobip SMTP as a relay. There is, however, a restriction when it comes to senders, which can be used for relying upon the messages.

You must use your Infobip-supplied credentials for authentication.

Integrate with SMTP API

To integrate with the Infobip SMTP API, use the following settings to set up a basic client configuration for your region.

For authorization to any SMTP, use Infobip Account Basic Authorization (username and password).

Port 587 is recommended and port 465 can be used, if 587 is not available. Port 25 can be used but is not recommended generally because some ISPs tend to block this port.

For connection security:

  • Port 587 and 25 support STARTTLS
  • Port 465 supports TLS
RegionServer NamePort
Frankfurt - Recommendedsmtp-api.infobip.com587, 465, 25
USA*smtp-api-us.infobip.com587, 465, 25
India (Mumbai)smtp-api-mum.infobip.com587, 465, 25
Indonesiasmtp-api-id.infobip.com587, 465, 25
MENAsmtp-api-ae2.infobip.com587
Pakistansmtp-api-pk2.infobip.com587
Turkeysmtp-api-tr1.infobip.com587
Saudi Arabiasmtp-api-sa2.infobip.com587
Qatarsmtp-api-qa1.infobip.com587

For Schrems II (opens in a new tab) compliance, use smtp-api-eu.infobip.com (opens in a new tab) and one of the available ports: 587, 465, 25.

* USA: For the email message to be processed and sent within the specified region (Domain Controller), the IP address from that region must be used on a domain you are using. To enable the IP address, contact [email protected] or your dedicated CSM.

Authentication

SMTP authentication provides basic security to ensure that messages are safely exchanged and prevent misuse of the server.

Infobip SMTP supports the PLAIN and LOGIN authentication mechanisms. Both mechanisms require a username and password. For basic authentication, use your Infobip account username and password.

  • PLAIN: transmits the username and password in one string encoded in Base64
  • LOGIN: works in the same way as PLAIN but transmits the username and password individually

For authentication (opens in a new tab) with an Infobip API key, use the following credentials:

SettingsValue
User NameApp
PasswordAPI key (same as for authentication over HTTP)

See API Authentication for more information on using API Keys.

Optional headers

Custom headers let you provide additional information for your outgoing SMTP emails.

Here's a list of supported headers.

Property nameHeader nameDescription
bulkIdX-IB-bulk-idThe ID uniquely identifies the sent email request.
trackingUrlX-IB-tracking-urlThe URL on your callback server on which the open and click notifications are sent.
intermediateReportX-IB-intermediate-reportSet to true for receiving the real-time Intermediate delivery report on your callback server.
notifyUrlX-IB-notify-urlThe URL on your callback server on which the Delivery report are sent.
notifyContentTypeX-IB-notify-content-typePreferred Delivery report content type.Can be application/json or application/xml.
callbackDataX-IB-callback-dataAdditional client's data sent on notifyUrl.

Supported SMTP commands

The Infobip SMTP server supports the following commands:

SMTP command

Description

HELPReturns information about the full list of SMTP commands.
HELOStarts the conversation identifying the sender server and is generally followed by its domain name.
EHLOStarts the conversation identifying the sender server when the server is using the Extended SMTP protocol.
AUTHClient authenticates itself to the server using the username and password.
MAIL FROMSender states the source email address in the “From” field and starts the email transfer.
RCPT TOIdentifies the recipient of the email. For multiple recipients, the command is repeated for each address.
DATAEmail content begins to be transferred; it’s generally followed by a 354 reply code given by the server, giving the permission to start the actual transmission.
RSETTerminates the email transmission but does not close the SMTP conversation.
QUITTerminates and closes the SMTP conversation.
NOOPChecks whether the server can respond.
STARTTLSStarts the secure connection.
NOTE

Email addresses present in the DATA (to and cc) should also be present in the RCPT TO field.

Test SMTP with Telnet

The following instructions explain how to test your SMTP communication with Telnet, describing:

  • Starting SMTP communication
  • How to authenticate
  • Adding email content

Start SMTP communication

To start using SMTP communication, try connecting to the Infobip SMTP API. Infobip accepts STARTTLS connections on port 587. In addition, ports 25 and 465 are supported on-demand.

To use these instructions, you need to have installed openssl on your machine.

  1. Open the Command Prompt or PowerShell and install openssl to connect using STARTTLS. Type:

    openssl s_client -connect smtp-api.infobip.com:587 -starttls smtp -quiet

    The -quiet option keeps the connection open even when special characters are used as input. For example, the Q letter closes the connection without this option.

    If you experience issues with this command, try using the -crlf option, which forces a line break when you press Enter and may be required by some servers. For example:

    openssl s_client -crlf -connect smtp-api.infobip.com:587 -starttls smtp -quiet

    You see a response similar to the following:

    CONNECTED(00000220)  --------------you will see the whole certificate value here------------------  250 Ok 

  2. Introduce your server to the Infobip SMTP server, using the EHLO command:

    EHLO smtp-api.infobip.com

    Use this command to check the server status. The server responds with the EHLO options that are supported.

    The Infobip supported options are:

    • 250-smtp.email-messaging.com
    • 250-8BITMIME 
    • 250-SIZE 20971520 
    • 250-STARTTLS 
    • 250-AUTH LOGIN PLAIN
    • 250 Ok

Authenticate your SMTP connection

Infobip servers require you to authenticate using your Infobip account username and password.

  1. To start the authentication, type AUTH LOGIN.

    The mail server responds with 334 VXNlcm5hbWU6, which is a Base64 encoded request for your username, so you need to provide your Base64 converted username.

  2. Type Base64 converted username.

    The mail server responds with 334 UGFzc3dvcmQ6. This response is a Base64 encoded request for your password, so you need to respond with the Base64 converted password.

  3. Type Base64 converted password.

    The mail server responds with 235 Authentication successful.

    When you have completed these steps, your connection to smtp-api.infobip.com over the chosen port is open and your username and password are valid.

Add email content

Create the email content that you are sending.

  1. Add the email that you are sending from using the SMTP MAIL FROM command, and press Enter.

    MAIL FROM: <sender_email>

    The mail server responds with 250 Sender address accepted.

  2. Add the email that you are sending to using the SMTP RCPT TO command, and press Enter.

    RCPT TO: <recipient_address>

    You can add more RCPT TO addresses during this step. Repeat the process by adding another RCPT TO command and pressing Enter for each recipient you intend to deliver the message to. The mail server responds with 250 Recipient address accepted after each recipient is added.

  3. On the next line, type DATA and press Enter.

    The mail server responds with 354 Continue. Unlike the MAIL FROM and RCPT TO commands, which are part of the email envelope, the DATA command is not meant to contain information that routes your email from a sender to a recipient. Instead, DATA allows you to modify the content of your message.

  4. Optionally, add a mail-to header to add the name to email address of the recipient to the email header and press Enter. Wrap the name in quotation marks, and wrap the address in a greater than and less than symbol.

    To: "<RecipientName>" <<RecipientEmailAddress>>

  5. Also, you can define a name for a sender email address that you use for testing.

    From: "<SenderName>" <<SenderEmail>>

  6. Include a Subject: line in your email and press Enter.

    Subject: <EMAIL_SUBJECT>

  7. Press Enter again to add a carriage line return. Add the body content of the message and press Enter. Ensure that you specify Content-Type as either text/plain or text/html.

    Body content
    		"From: Some One [email protected]
    		Subject: This is the subject of sample message
    		MIME-Version: 1.0
    		Content-Type: multipart/mixed;
    			boundary="XXXXboundary"
    		This is a multipart message in MIME format.
    		--XXXXboundary
    		Content-Type: text/plain;
    		This is the plain content
    		--XXXXboundary
    		Content-Type: text/html;
    		<h1> This is the HTML content </h1>
    		--XXXXboundary—"
  8. Finally, send the email by typing a period ( . ) and then press Enter.

    The period is to signify that the mail body is now completed. The mail server returns 250 Ok. This means the email has been queued to send. The queue moves very quickly, and you see mail delivered to the designated recipients shortly.

To exit the Telnet connection, type quit and press Enter.

Testing SMTP with Thunderbird

The following instructions explain how to test your SMTP communication with ThunderBird.

  1. Install Thunderbird.

  2. Configure one of your existing (incoming) email addresses. You have to configure the client email address before you can send an email.

  3. Right-click on your email account > Settings > Outgoing Server, and then click Add.

  4. Add a description, for example infobip smtp api, and set the following properties.

    PropertyValue
    Server Namesmtp-api.infobip.com
    Port587
    Connection securitySTARTTLS
    Authentication methodNormal Password
    User Nameusername
  5. Replace the username with the correct account authentication data. Make sure that you set this server as the default.

  6. Compose your email.

    The senders are restricted on the Infobip platform, so you must use one of your Infobip verified domains (or registered senders). In Thunderbird, click Customize From Address from the From field.

  7. Click Send. You may be asked to provide a password in this step.

NOTE

If your credentials are not correct, or if the sender is not authorized, you see an error message.

Need assistance

Explore Infobip Tutorials

Encountering issues

Contact our support

What's new? Check out

Release Notes

Unsure about a term? See

Glossary

Research panel

Help shape the future of our products
Service Terms & ConditionsPrivacy policyTerms of use