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.fed...@gmail.com<smtp%3aalex.fed...@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
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to