Send an email.
Mail(smtpServer, smtpUsername, smtpPassword, mailTo, title, body)Examples
javascript
function main(){
Mail("smtp.163.com", "[email protected]", "password", "[email protected]", "title", "body")
}
python
def main():
Mail("smtp.163.com", "[email protected]", "password", "[email protected]", "title", "body")
rust
fn main() {
Mail("smtp.163.com", "[email protected]", "password", "[email protected]", "title", "body");
}
c++
void main() {
Mail("smtp.163.com", "[email protected]", "password", "[email protected]", "title", "body");
}Returns
| Type | Description |
bool | Returns a truthy value, such as |
Arguments
| Name | Type | Required | Description |
smtpServer | string | Yes | Used to specify the |
smtpUsername | string | Yes | Used to specify the email address of the email sender. |
smtpPassword | string | Yes | Used to specify the |
mailTo | string | Yes | Used to specify the email address of the email recipient. |
title | string | Yes | The email subject. |
body | string | Yes | The email body. |
See Also
Remarks
The smtpPassword parameter sets the password for the SMTP service, not the mailbox login password.
When setting the smtpServer parameter, if you need to change the port, you can append the port number directly in the smtpServer parameter. For example: the smtp.qq.com:587 port of QQ Mail has been tested and works.
If the error unencryped connection occurs, you need to modify the smtpServer parameter of the Mail function to the format ssl://xxx.com:xxx. For example, the ssl method for QQ Mail SMTP is ssl://smtp.qq.com:465, or use smtp://xxx.com:xxx.
This function does not work in the backtesting system.