Skip to main content

How to enable email service

SMTP Server Configuration

Click the profile photo and go to Platform Mgt > Service Integration > Email Service:

Configuration for Common SMTP Server

Note: If using port 25, some servers may require unblocking port 25.

Tencent Exmail

The administrator needs to enable POP/SMTP/IMAP for configuring email sending. For more details, visit https://work.weixin.qq.com/help?person_id=1&doc_id=277&helpType=exmail.

Use the Exmail account and password to configure the email service. The email and account should be the same.

ServerPort (non-SSL)Port (SSL)
smtp.exmail.qq.com25 or 587465

Alibaba Cloud Exmail

The administrator needs to enable POP/SMTP/IMAP for configuring email sending.

Use the Exmail account and password to configure the email service. The email and account should be the same.

ServerPort (non-SSL)Port (SSL)
smtp.mxhichina.com25 or 587465

Alibaba Cloud Mail

Enable POP/SMTP/IMAP for configuring email sending.

Use the email account and password to configure the email service. The email and account should be the same.

ServerPort (non-SSL)Port (SSL)
smtp.aliyun.com25465

Tencent QQ Mail

Enable POP/SMTP/IMAP for configuring email sending.

Use the email account and authorization code (not email password). to configure the email service. The email and account should be the same.

ServerPort (non-SSL)Port (SSL)
smtp.qq.com25 or 587465

189 Mail

Enable POP/SMTP/IMAP for configuring email sending.

Use the email account and password to configure the email service. The email and account should be the same.

ServerPort (non-SSL)Port (SSL)
smtp.189.cn25 or 587465

163 Mail

Enable POP/SMTP/IMAP for configuring email sending.

Use the email account (only the part before "@") and authorization code (not email password). to configure the email service. The email and account should be the same.

ServerPort (non-SSL)Port (SSL)
smtp.163.com25465

If the email sending fails, please check the connectivity using the following commands.

docker exec -it $(docker ps | grep -E 'hap-community|hap:' | awk '{print $1}') bash -c 'nc -vz server port'

Self Integration

Additionally, it supports configuring a Webhook URL to receive emails and then implement email sending independently.

  1. Create a configuration file appextensions.json

    For example: /data/hap/script/volume/email/appextensions.json:

    {
    "WebhookUrl": "https://api.yourdomain.com/email/webhook",
    "WebhookHeaders": {}
    }

    Configuration Parameters:

    • WebhookUrl: Required, the API endpoint for receiving email messages.
    • WebhookHeaders: Optional, custom request headers for authentication and other purposes.
  2. Message Body Specification

    HAP sends JSON data to WebhookUrl via POST with application/json format. The message body format is as follows:

    {
    "ToEmails": ["email1","email2"],
    "ReplyToEmails": ["email1","email2"],
    "CcEmails": ["email1","email2"],
    "BccEmails": ["email1","email2"],
    "Signature": "Signature",
    "Subject": "Email Subject",
    "Body": "Email Body",
    "Attachments": { "Attachment Name 1": "Download Link 1", "Attachment Name 2": "Download Link 2" }
    }

    Field Descriptions:

    • ToEmails: List of recipient emails
    • ReplyToEmails: List of emails to reply to by default
    • CcEmails: List of CC emails
    • BccEmails: List of BCC emails
    • Signature: Sender's name
    • Body: Content in HTML format
    • Attachments: Mapping of attachment names to download URLs
  3. Mount the configuration file appextensions.json to the microservice container at /usr/local/MDPrivateDeployment/email/appextensions.json.

    Add the following to the docker-compose.yaml file under the app service's volumes:

    - ./volume/email/appextensions.json:/usr/local/MDPrivateDeployment/email/appextensions.json
  4. Restart the service