【问题标题】:Python: Open Thunderbird to write new mail with attached filePython:打开 Thunderbird 编写带有附件的新邮件
【发布时间】:2014-09-06 09:30:04
【问题描述】:

我想在 Debian 和 Windows 上打开 Thunderbird,并附上新电子邮件的附件。

所以我想在这个线程中做同样的事情,但发布的解决方案不起作用:

Python open email client with attachment

我和 user2686223 有同样的问题。该文件不会附加到邮件中。谁能帮我解决这个问题?

也许有其他解决方案?

编辑:现在它是这样工作的:

import os
os.system("thunderbird -compose to='test@test.de',subject='subject',body='body',attachment='/path/to/file'")

【问题讨论】:

    标签: python email cross-platform email-attachments thunderbird


    【解决方案1】:

    使用命令行参数“-compose”启动 Thunderbird。 更多信息请访问http://kb.mozillazine.org/Command_line_arguments_%28Thunderbird%29

    【讨论】:

    • 非常感谢。正是我想要的!
    【解决方案2】:

    使用上面列出的 mozillazine 中的信息,我能够让它在 Windows 7 上与 Python 2.7 一起使用

    import subprocess
    tbirdPath = r'c:\Program Files (x86)\Mozilla Thunderbird\thunderbird.exe'
    to = 'recipiant@example.com'
    subject = 'Hello'
    body = '<html><body><h1>Header</h1>This is the body<br></body></html>'
    composeCommand = 'format=html,to={},subject={},body={}'.format(to, subject, body)
    subprocess.Popen([tbirdPath, '-compose', composeCommand])
    

    【讨论】:

      猜你喜欢
      • 2013-10-05
      • 2014-08-14
      • 1970-01-01
      • 2015-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多