SMTP, or simple mail transfer protocol, is a quick and easy way to send email from one server to another. SendGrid provides an SMTP service that allows you to deliver your email via our server instead of your client or server.
SendGrid’s SMTP API allows developers to specify custom handling instructions for email using an X-SMTPAPI header inserted into the message. The header is a JSON encoded list of instructions and options for that email.
The X-SMTPAPI headers that you add are stripped from the final email because they are instruction headers for how SendGrid will handle your email.
For a deeper dive into what SMTP is, the benefits of sending an email with SMTP, and how SendGrid can help, see the SMTP Service Crash Course on our blog.
echo -n '<<YOUR_API_KEY>>' | openssl base64. Save your converted key for a later step.
Telnet does not register backspaces correctly - so you have to type your commands correctly (or copy and paste it from here).
To send X-SMTP email using Telnet:
TELNET smtp.sendgrid.net 25.
334 VXNlcm5hbWU6, a Base64 encoded request for your username. If you receive this error:
'telnet' is not recognized as an internal or external command, operable program or batch file, you need to install Telnet on your machine. Telnet comes natively on most operating systems.
apikey, which is
334 UGFzc3dvcmQ6. This response is a Base64 encoded request for your password (your API Key).
235 Authentication successful. Getting this far indicates that your connection to smtp.sendgrid.net over the chosen port is open and that your API key is valid.
250 Sender address accepted.
250 Recipient address accepted.
DATA- this indicates that you’re typing the email content.
To: <<NAME>> <<EMAIL>>.
From: NAME <<EMAIL>.
<<MESSAGE>>. For example:
“This is a test for the SMTP relay."
250 Ok: queued as …- This means the email has been queued to send. This queue moves very quickly.
Now that you've sent a test email, learn to integrate your servers with our SMTP service.
Message size limit: The total message size should not exceed 20MB. This includes the message itself, headers, and the combined size of any attachments.