发送邮件。
Mail(smtpServer, smtpUsername, smtpPassword, mailTo, title, body)示例
通过163邮箱的SMTP服务发送一封邮件。
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");
}返回值
| 类型 | 描述 |
bool | 邮件发送成功时返回真值,例如 |
参数
| 名称 | 类型 | 必填 | 描述 |
smtpServer | string | 是 | 用于指定邮件发送方的 |
smtpUsername | string | 是 | 用于指定邮件发送方的邮箱地址。 |
smtpPassword | string | 是 | 用于指定邮件发送方邮箱的 |
mailTo | string | 是 | 用于指定邮件接收方的邮箱地址。 |
title | string | 是 | 邮件标题。 |
body | string | 是 | 邮件正文。 |
参考
备注
smtpPassword参数设置的是SMTP服务的密码,而非邮箱登录密码。
设置smtpServer参数时,如需更改端口,可直接在smtpServer参数中附加端口号。例如:QQ 邮箱的smtp.qq.com:587端口经测试可用。
如果出现报错unencryped connection,则需要修改Mail函数的smtpServer参数,其格式为ssl://xxx.com:xxx。例如,QQ 邮箱SMTP的ssl方式为ssl://smtp.qq.com:465,或使用smtp://xxx.com:xxx。
该函数在回测系统中不起作用。