Advanced mailto use in Python
<p>I'm trying to send an email with custom recipient, subject and body in Python.
This means I don't want to use <a href="http://stackoverflow.com/questions/6270782/how-to-send-an-email-with-python">Python's smtp packages</a>, but something like <a href="https://docs.python.org/2.7/library/webbrowser.html?highlight=webbrowser#module-webbrowser" rel="nofollow">webbrowser</a> because I need this to open the default email client (Thunderbird in my case) with said arguments. </p>

<pre><code>import webbrowser
webbrowser.open("mailto:?to=aaa@email.com&amp;subject=mysubject", new=1)
</code></pre>

<p>works but I need it to get the recipient from a string I previously found and body from a text file I previously created.</p>

<p>Is there any "simple" way to do it that I cannot find?
Thanks in advance.</p>

<p>Use string concatenation.</p>

<pre><code>recipient = 'aaa@email.com'
subject = 'mysubject'
body = 'This is a message'
webbrowser.open("mailto:?to='+ recipient + '&amp;subject=' + subject + "&amp;body=" + body, new=1)
</code></pre>

python python-2.7 email python-webbrowser