Sending Emails

This document describes how to configure the sender information for sending emails. The configuration file can be located in one of the following two locations:

  1. In the root directory of the configuration directory, named email.yaml.
- configs/
  |-- email.yaml
  1. In any other directory with a custom name, and then specified using the -e or --email-config-file option.

Configuration Example

---
sender: oredge@openresty.com
password: SENDER_PASSWORD
smtp_server: smtp-mail.outlook.com
smtp_port: 587
new_user_email_template:
  subject: 'Your OpenResty Edge account is ready!'
  content: |
    Your OpenResty Edge account is ready!

    Please login to https://oredge.admin.com

    Username: {{ username }}(ID: {{ user_id }})
    Password: {{ password }}
    User Group: {{ user_group }}(ID: {{ user_group_id }})

    If you have any questions, please contact oredge@openresty.com

The meaning of each field in the configuration file is as follows:

  • sender: The sender’s email address.
  • password: The password for logging into the sender’s email account. If two-step verification is enabled, you may need to create and use an app-specific password. For example, you can create an app-specific password on the Microsoft Account Security page or the Google Account Security page.
  • smtp_server: The SMTP server address. Standard SMTP servers such as Google’s smtp.gmail.com and Microsoft’s smtp-mail.outlook.com.
  • smtp_port: The SMTP server port, usually 587.
  • new_user_email_template: The email template for sending email notifications when a new user is created.
    • subject: The subject of the email.
    • content: The body of the email. The following template variables can be used:
      • {{ username }}: The newly created username.
      • {{ user_id }}: The ID of the newly created user in the Edge Admin system.
      • {{ password }}: The password for that user.
      • {{ user_group }}: The name of the user group to which the user belongs.
      • {{ user_group_id }}: The ID of the user group to which the user belongs in the Edge Admin system.