Skip to main content

Issue

Users need guidance on how to send emails from Domino using Python’s smtplib library, including how to set up a secure SMTP connection, send plain-text emails, and send HTML-formatted emails using MIME.

Root cause

Sending emails from Domino requires configuring a secure SMTP connection and using the correct Python libraries. Without proper setup of connection security, authentication, and MIME formatting, emails may fail to send or render incorrectly.

Resolution

This article covers three topics:
  • Setting up a secure SMTP connection using SMTPS or STARTTLS
  • Sending plain-text emails using smtplib
  • Sending HTML-formatted emails using the email.mime module

1. Setting up a local SMTP debug server

To test your code locally, use the Python smtpd binary bound to port 1025. Messages will not leave localhost and will be output to stdout as a byte stream:

2. Starting a secure SMTP connection

There are two ways to secure your SMTP connection. Both examples use Gmail’s SMTP server and Python’s ssl package to load the system’s default trusted CA bundles via create_default_context(). Option A: SMTPS (secured from the outset)
Option B: STARTTLS (connection secured after initial handshake)

3. Sending a plain-text email

Define the sender, receiver, and message body at the top of your script. Use server.sendmail to send the email. Using SMTPS:
Using STARTTLS:

4. Sending HTML-formatted emails using MIME

Use the email.mime module to send emails combining HTML and plain-text content. Since email clients render the last MIME part first, the HTML part must be added after the plain-text part.

Notes

When configuring for a production Domino deployment (assumed to use AWS SES as the SMTP server), the following values are required:
  • SMTP host: The server name from the SMTP settings page, accessible via the AWS SES service page.
  • SMTP username and password: Generate these from the SMTP settings page using the Create My SMTP Credentials button.
  • These values should be available in Domino Central Config. If not, they must be added as Central Config key-value pairs. Contact your internal Domino admin for assistance.
  • The code examples in this article are provided as a reference. Some adjustments and indentation corrections may be needed to suit your specific application.
Last modified on October 12, 2026