【问题标题】:How to insert image in Yagmail? (Python)如何在 Yagmail 中插入图片? (Python)
【发布时间】:2018-07-12 02:21:43
【问题描述】:

我有一个 Yagmail 脚本,我想在其中发送格式如下的电子邮件:

你好!下面是一张图片。

img.png

再见!

但是,我的脚本只是将图像一直发送到电子邮件的底部。这是我的代码:

img = "img.PNG"
body = "Hello! Below is a picture." + img + "Goodbye!"

contents = [body, img]
yag.send("receiver@gmail.com", "Subject", contents)

您将如何使用可以在文本块之间放置图像的格式发送电子邮件?有帮助!

【问题讨论】:

    标签: python image email smtp yagmail


    【解决方案1】:
    contents = [yagmail.inline("/path/to/local/image")]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多