Re: Options for sending email
- Posted by Spock Jun 18, 2014
- 1717 views
If I knew how to send emails from my programs I could unify & streamline that entire area of our company process. So what are my options for intelligently sending automated emails?
Maybe someone with direct experience on this would like to comment/advise..
I have done this before.
What if I sent the email data directly to the SMTP server instead?
If you can do this, then in my experience this is the best method.
Here's a simple, very stupid, quick&dirty example that sends a plain text email w/o any error or exception handling: http://openeuphoria.org/pastey/246.wc
Note that attaching files to an email is a little bit trickier - you need to add some MIME data and use base64:encode to encode the file, then append that to the end of the email's text body.
From email.exw et al I have added Simple MAPI routines to my program but this relies on there being support for this in the default email client to work. In MS Outlook a security feature keeps prompting the user to verify each email being sent. When sending eg, 100, emails at a time, it would be quite tedious to keep clicking some button those 100 times. Is there a way to avoid this? I haven't figured out how to send (correct) credentials to the MAPI routines.
You have to use the extended MAPI to get around this. It's quite involved. This is the simplest example I could find: https://mail.python.org/pipermail/python-win32/2004-August/002239.html
You'd need a MAPIEx wrapper though. Not sure if anyone has made one for Euphoria yet. If not, then the simplest thing to do would be to take this, http://www.codeproject.com/Articles/10881/MAPIEx-Extended-MAPI-Wrapper , and then wrap the C using C, then wrap the C code with an Euphoria wrapper.
Jim,
Thanks for the quick reply (and the example). I agree with you that an SMTP module would be the best way to go.
[If I ever get stuck writing this code I'll know who to ask for help.. ]
Spock