小编LMP*_*LMP的帖子

如何使用 smtp 发送内联 html 电子邮件的 plot.ly 图像?

我正在自动化几个双周报告,所以我决定使用 plot.ly 创建一个线图。此线图具有不同数量的跟踪,具体取决于正在运行的报告。
我已经能够成功创建绘图,但我发现的所有方法都无法在我的电子邮件中内联显示绘图。这是我的代码:

SMTP_SERVER = "smtp.office365.com"
SMTP_PORT = 587
SMTP_USERNAME = username
SMTP_PASSWORD = password
EMAIL_TO = email_to
EMAIL_FROM = email_from

#here we loop through our data-set and pull out rows to make different traces
for deal in winGraph['DEAL_IDENTIFIER'].unique():
    matched_rows = winGraph.loc[winGraph['DEAL_IDENTIFIER'] == deal]
    date = matched_rows.DATE.tolist()
    winRate = matched_rows.WIN_RATE.tolist()
    traces.append(
                 go.Scatter(
                            x = date,
                            y = winRate,
                            name = str(deal)
                             )
                  )
plotly.tools.set_credentials_file(username = 'username', api_key = 'api_key')                        
fig = dict(data = traces)

imageURL = py.plot(fig,auto_open = False, …
Run Code Online (Sandbox Code Playgroud)

python email smtp pandas plotly

6
推荐指数
1
解决办法
5400
查看次数

标签 统计

email ×1

pandas ×1

plotly ×1

python ×1

smtp ×1