Evolution is intended as a GUI e-mail client, so the scripting options are limited. Also, it looks like you cannot autosend e-mail from a script, there's so script command equivalent to the 'send' button.
But that's a good thing; I can autosend from
nail when I want to. So a script will compose the e-mail, which will sit on my desktop until I review it and click to send it. Nice.
shell command source
This command creates a window with To:, From:, Subject:, and Body filled in. 'From:' is already known by Evolution, the rest is parsed from the following command:
Another (easier) way:
evolution mailto:firstname.lastname@example.org?cc="email@example.com"\&subject="This Is The Subject"\&body="This is the body of the message"\&attach=Desktop/test_file.xml
evolution mailto:firstname.lastname@example.org- Launches Evolution's e-mail composer and To: line
?cc="Person@example.com"- CC: Line
?subject="Subject"- Subject line
\&body="Body"- Body of the e-mail is everything after this line
\&attach=/path/file- Files to attach
%0D%0A- CR/LF (new line)
Python 2.x has it's own smtp module for creating e-mail, it's far more useful in most circumstances. But in this case, we want the composed evolution window.
import os body_string = 'This is the body of the e-mail message' body_string = body_string.replace(' ','%20') os.popen('evolution mailto:email@example.com?subject=Test\&body=' + body_string)
import os- Use python's os module
body_string = 'This is the body of the e-mail message'- The body in normal text
body_string = body_string.replace(' ','%20')- Encode the spaces (evolution will decode them). Tabs, newlines, and other reserved strings need to be encoded.
os.popen('evolution mailto:firstname.lastname@example.org?subject=Test\&body=' + body_string)- The 'os.popen(cmd)' executes shell cmd. Note that cmd is just a python string, and you can use all the string tools on it, like adding body_string.
>>> import os >>> to = 'email@example.com' >>> cc = '"firstname.lastname@example.org"' >>> subject = '"This is the subject"' >>> body = '"This is the body"' >>> attachment = 'Desktop/rss_test.xml' >>> os.popen('evolution mailto:'+to+'?cc='+cc+'\&subject='+subject+'\&body='+body+'\&attachment='+attachment)