Skip to content

Sending an email

A simple email

A simple text-only email, nothing fancy. Rplace your.smtpserver.com with the name or IP address of the SMTP server you use.

A simple email with TLS

The same as above, with negotiating a TLS session.

Using credentials (feat. AWS SES with SMTP)

This code example demonstrates using a username and password to authenticate with the SMTP server. In particular, the example uses AWS's Simple Email Service (SES) by way of SMTP. See also Using SES API below. The SMTP host will be different if you are using a different region.

Sending HTML formatted email

The following code examples will send an email that looks like this:

NOTE: you can convert a file into base64 as used above with

To load the image from a file (instead of embedding the base 64 as shown above) use cid: with an arbirary identifier ( the examples below use banner) to push the image into your html as a separate part.

Using the AWS SES API

This shows the API: