3

I'm trying to open a email-client (eg thunderbird) to send an email with an attachment. I have tried to open the client with webbrowser.open('mailto:[...]?attachment="path_to_file"'), but there was no attachment. I also tried to write file://path_to_file. I have searched in the web for a solution, but there I only found tutorials how to send emails with SMTP. Do you have an idea?

user2686223
  • 39
  • 1
  • 4

2 Answers2

1

I would use this python recipe for a portable and sound way to send mails with attachments in python.

enrico.bacis
  • 30,497
  • 10
  • 86
  • 115
  • Thanks for your fast answer. With `python t.py -m a@g.com --attach="file://home/aha/top.png"` a client (thunderbird) is opening but without a file as attachment. mailto_string in line 286 is: `mailto:a@g.com?attach=file%3A%2F%2Fhome%2Faha%2Ftop.png` what am I doing wrong? – user2686223 Aug 23 '14 at 10:23
0

You can achieve the same result by calling thunderbird via system commands.

Here is a thread that I started. I got a good reply:

Python: Open Thunderbird to write new mail with attached file

Community
  • 1
  • 1
Ohumeronen
  • 1,769
  • 2
  • 14
  • 28