Skip to content

Outgoing mail configuration

HouzuoGuo edited this page Dec 31, 2019 · 13 revisions

Outgoing mail configuration

Introduction

A shared outgoing mail configuration must be created, in order for the following components to send emails:

Configuration

Construct the following object under JSON key MailClient:

Property Type Meaning
AuthUsername string SMTP access username. Leave it empty if not required.
AuthPassword string SMTP access password. Leave it empty if not required.
MTAHost string Host name of MTA on SMTP server, for example "smtp.sendgrid.net".
MTAPort integer Port of MTA on SMTP server, for example 2525.
MailFrom string "From" address to appear in outgoing mails.

Configuration example

Here is an example for using SendGrid to send outgoing emails:

{
    ...

    "MailClient": {
        "AuthPassword": "SG.aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz",
        "AuthUsername": "apikey",
        "MTAHost": "smtp.sendgrid.net",
        "MTAPort": 2525,
        "MailFrom": "i@howard.gg"
    },

    ...
}

Tips

If laitos is running on public cloud, be aware that several public cloud providers (such as Google Compute Engine) does not allow servers themselves to deliver any email via local mail transportation agents (e.g. postfix, sendmail). This is usually done to prevent spam.

In that case, you will have to use a mail delivery service such as SendGrid to send emails. For the case of Google Compute Engine, check out this detailed topic written by Google: Sending Email from an Instance

As a security measure, a program-wide 200MB temporary buffer stores outstanding outgoing mail. Once the buffer fills up, new mails will not be queued or delivered. The buffer does not fill up unless there is a prolonged MTA host outage.

Clone this wiki locally