send_email - 发送邮箱信息
send_email 是 PTrade 中用于发送邮箱信息的接口。
提示
live-or-trading-module-onlypermission-dependent
原型
send_email(send_email_info, get_email_info, smtp_code, info='', path='', subject='')
释义
send_email 是 PTrade 中用于发送邮箱信息的接口。
研究:不支持;回测:不支持;模拟:官方目录未明确;实盘:支持。
参数
| 参数 | 是否必填 | 官方原始定义 |
|---|---|---|
send_email_info |
是 | send_email_info |
get_email_info |
是 | get_email_info |
smtp_code |
是 | smtp_code |
info |
否 | info='' |
path |
否 | path='' |
subject |
否 | subject='' |
返回值
None
示例
def initialize(context):
g.security = '600570.SS'
set_universe(g.security)
def handle_data(context, data):
#发送文字信息
send_email('[email protected]', ['[email protected]', '[email protected]'], 'phfxxxxxxxxxxcd', info='今天的股票池信息')
详细说明
send_email(send_email_info, get_email_info, smtp_code, info='', path='', subject='')
使用场景
该函数仅在交易模块可用。
接口说明
该接口用于通过QQ邮箱发送邮件内容。
注意事项
该接口需要服务端连通外网,是否开通由所在券商决定。
是否允许发送附件(即path参数),由所在券商的配置管理决定。
邮件中接受到的附件为文件名而非附件路径。
参数详细说明
send_email_info:发送方的邮箱地址,必填字段,如:[email protected](str);
get_email_info:接收方的邮箱地址,必填字段,如:[email protected], [email protected](list[str]/str);
smtp_code:邮箱的smtp授权码,注意,不是邮箱密码,必填字段(str);
info:发送内容,选填字段,默认空字符串(str);
path:附件路径,选填字段,如:get_research_path() + 'stock.csv',默认空字符串(str);
subject:邮件主题,默认空字符串(str);
返回值
None