85976

Python open email client with attachment

Question:

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?

Answer1:

I would use <a href="http://code.activestate.com/recipes/511443-cross-platform-startfile-and-mailto-functions/" rel="nofollow">this</a> python recipe for a portable and sound way to send mails with attachments in python.

Answer2:

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

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

<a href="https://stackoverflow.com/questions/25698821/python-open-thunderbird-to-write-new-mail-with-attached-file/25705516#25705516" rel="nofollow">Python: Open Thunderbird to write new mail with attached file</a>

Recommend

  • zend smtp mail crashes after 100+ mails
  • Image in Email Subject using PHP
  • Paypal reports email address already taken when trying to import test accounts into Paypal Developer
  • How to configure Monolog to send errors via SwiftMailer to alternate mailer in Symfony2
  • Google Contacts API get phone number (PHP)
  • Custom Keyboard or to create own keyboard
  • mail server requires authentication when attempting to send to a non-local e-mail address when using
  • What is “PHP-standardized” version number strings?
  • SmtpClient sends email to junk
  • Generating random numbers directly inside a .htaccess file
  • How to create virtual printer with iOS Simulator?
  • Facebook iOS SDK Not Calling Completion Handler
  • import scipy.sparse failed
  • During installation of Django, why do I keep getting ImportError: No module named django?
  • where do I find the xml.dom python package for the python-2.6.0-8.9.28 and I have a suse/x86_64 vers
  • Python pickle not one-to-one: different pickles give same object
  • Do I need to seed any random number generator before using EVP_PKEY_keygen of OpenSSL?
  • Email verification using google app script and google forms
  • Setting up SourceTree to merge unity3d scenes with UnityYAMLMerge
  • Record samples being played with OpenAL
  • Typescript - Unable to get 'import' statement to function
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • Email format validation in mvc3 view
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • Read text file and split every line in MSBuild
  • C# - Serializing and deserializing static member
  • How to add date and time under each post in guestbook in google app engine
  • Excel - Autoshape get it's name from cell (value)
  • Java applet as stand-alone Windows application?
  • Check if a string to interpolate provides expected placeholders
  • RestKit - RKRequestDelegate does not exist
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Is there a mandatory requirement to switch app.yaml?
  • Traverse Array and Display in markup
  • Load html files in TinyMce
  • Error creating VM instance in Google Compute Engine
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • coudnt use logback because of log4j
  • UserPrincipal.Current returns apppool on IIS