Here is quick script showing how to use Python to send email from Windows.
This approach uses the Python For Windows Extensions to access Outlook/Exchange with CDO (Collaboration Data Objects).
#!/usr/bin/env python
# Corey Goldberg
from win32com.client import Dispatch
session = Dispatch('MAPI.session')
session.Logon('','',0,1,0,0,'exchange.foo.com\nUserName');
msg = session.Outbox.Messages.Add('Hello', 'This is a test')
msg.Recipients.Add('Corey', 'SMTP:corey@foo.com')
msg.Send()
session.Logoff()
2 comments:
You should post the corresponding .Net code (which I wrote once). From what I recall it ain't anywhere near as succint.
that bloody Outlook security message is f**king everything up!
Post a Comment