You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
python-project/api/sendmail.py

13 lines
388 B

#!/usr/bin/python3
import yagmail
import sys
yag = yagmail.SMTP(
user='xxxx@163.com',
password='',
host='smtp.163.com', # 邮局的 smtp 地址
port='25', # 邮局的 smtp 端口
smtp_ssl=False)
# ./sendmail.py 收件人 主题 内容
yag.send(to=sys.argv[1],
subject=sys.argv[2],
contents=sys.argv[3])