[Tutor] Fwd: Sending Email - Outlook 2003 / Overcome Security Warning!
Alex Feddor
alex.feddor at gmail.com
Sat May 9 22:26:02 CEST 2009
Hi
I would like to send email inside my Python code. On PC I have installed
Outlook 2003. On the web I found code bellow which is working however I need
every time manual clicked outlook security warning - alerting that outside
process would like to send email. Please advise how the security warning can
be tricked...
Here is working code sample:
from win32com.client import Dispatch
session = Dispatch("MAPI.session")
session.Logon('OUTLOOK') # MAPI profile name
msg = session.Outbox.Messages.Add('Hellow', 'Test Message 400')
msg.Recipients.Add('ales',
'SMTP:alex.feddor at gmail.com<SMTP%3Aalex.feddor at gmail.com>
')
msg.Send()
session.Logoff()
On the web I found solution for VB.NET <http://vb.net/>. There must be
similar solution also for Python.
http://www.add-in-express.com/docs/outlook-security-manager-automate.php
(vb.NET CODE)
Dim SecurityManager As New AddinExpress.Outlook.SecurityManager
SecurityManager.ConnectTo(outlookApp)
I tried running VB code inside Python however with no success as this is not
VBScript.
import win32com.client as win
vbscript = win.Dispatch("ScriptControl")
vbscript.language = "vbscript"
vbscript.addcode('Main\n\
*Sub Main*\n\
*OlSecurityManager.ConnectTo OutlookApp*\n\
*OlSecurityManager.DisableOOMWarnings = True*\n\
*End Sub*\n')
vbscript.eval("Main")
Looking forward to your advice ...
Cheers, Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090509/a6d7e68a/attachment.htm>
More information about the Tutor
mailing list