簡體   English   中英

Python:打開Thunderbird以編寫附帶文件的新郵件

[英]Python: Open Thunderbird to write new mail with attached file

我想在Debian和Windows上打開Thunderbird,附帶一個新郵件的附件。

所以我想在這個帖子中做同樣的事情,但發布的解決方案不起作用:

Python打開帶附件的電子郵件客戶端

我和user2686223有同樣的問題。 該文件不會附加到郵件中。 誰能幫我這個?

也許用另一種方案?

編輯:這是現在的工作原理:

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

使用命令行參數“-compose”啟動Thunderbird。 更多關於它的信息,請訪問http://kb.mozillazine.org/Command_line_arguments_%28Thunderbird%29

使用上面列出的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])

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM