Short: sendmapi - sendmail equivalent which uses MAPI for Windows to send emails Author: "David 'tinman' McMinn" About ----- sendmapi came about when I was trying to set up mantis/bugzilla on our corporate network, for testing which would be most suitable. At first I used the fake sendmail for Windows from http://www.glob.com.au/sendmail/ (as it turns out, Bugzilla was the reason that was created). However, the Exchange server was soon to have SMTP access turned off to never be turned back on by our nice BOFH. MAPI was then the only option. sendmapi parses the email which is passed into it for important stuff (email addresses, subject, message, etc), then uses MAPI to send the message. Usage ----- It's a command line program: sendmapi -t < blah.txt where blah.txt is the message to be sent (or STDIN). There is also a sendmapi.ini file located in the same directory (you should specify the full path to the sendmapi executable in your scripts, otherwise it probably won't find the configuration). The fields are: [sendmapi] - Configuration section, everything must come under that error_logfile - Filename to write errors to debug_logfile - Filename to write debug info to auth_profile - Name of profile to use to access Exchange - the default under Windows is typically "MS Exchange Settings" (without the quotes) auth_domain - Domain of the user which has access rights to the profile above and exchange server auth_username - Username of the user to connect / send mail as auth_password - Network password logon - encrypted and ASCII-ified. See the tool "sendmapi_passwd" on how to generate this value. The last 3 setting values deal with impersonating a network user in order to send emails. If you're lazy and run your webserver service as e.g. LOCALSYSTEM then you'll probably not have rights to the network, in which case you'll want to set these up to impersonate a user who does. If they're left blank then no impersonation takes place. "auth_profile" is the name of a profile to take the mail settings from on the local PC running sendmapi. I think the only thing you really need to make sure of is that it is set up to use "NT Logon authentication", as that's the only thing I ever used (and tested it for). History ------- Version Date Description 0.1.2.3 20050927 Working with password encryption and impersonation so first release Issues ------ There's probably a really simple way using MAPI to send a message straight through the server but I never looked too hard for it. There's probably also tons of better ways to do it or reuse existing libraries, again I didn't find too much when I looekd for it. If the first issue can't be solved then there should be something which scans for attachments and passes them through too. However, SimpleMAPI doesn't support anything that nice and I really couldn't be bothered by this time. The security offered by the encryption is probably quite poor due to the lame way the key is generated and handled. License ------- Since this product uses some GPL source code it is also released under the GPL. See license.txt for information. MD5 source code - http://www.fourmilab.ch/md5/ See index.html or the above website for license. RC4 source code - http://www.cr0.net:8040/code/crypto/rc4/ See rc4.c and license.txt for license. -- [) /\ \/ ][ [) |\/| c |\/| ][ |\| |\| | ICQ=16827694 http://www.david-mcminn.co.uk | dave@blitz-2000.co.uk