Python:打开Thunderbird并附加fi来写新邮件

2024-04-25 15:19:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在Debian和Windows上打开Thunderbird,附带一个新的电子邮件文件。在

因此,我希望与此线程相同,但发布的解决方案不起作用:

Python open email client with attachment

我和用户2686223有同样的问题。文件不会附加到邮件中。有人能帮我吗?在

也许还有别的办法?在

编辑:这就是它的工作原理:

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

Tags: 文件totestattachmentos电子邮件windowsbody
2条回答

使用上面列出的mozillazine中的信息,我能够让它与windows7上的python2.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])

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

相关问题 更多 >