[Tutor] Can't run this script while I'm logged off of Windows XP
Eduardo Vieira
eduardo.susan at gmail.com
Fri Apr 3 21:53:13 CEST 2009
Hello, I'm making a script that daily grabs some information and email
it to some of my coworkers. It runs all the other parts while I'm
logged off, but this part doesn't. I need to be logged on for it to
work. Also, when I'm logged on to my Windows XP I just can't make it
send. It only sits in my mailbox. I have to manually press "send" to
get it sent.
here is the code that won't work:
import win32com.client
try:
s = win32com.client.Dispatch("Mapi.Session")
s.Logon("Default")
Msg = s.Outbox.Messages.Add("Daily Activity Report", report)
testaddresses = [
'test1 at expresssignproducts.com',
## '1 at expresssignproducts.com',
## '2 at expresssignproducts.com',
## '3 at expresssignproducts.com',
]
for address in testaddresses:
Msg.Recipients.Add(address)
Msg.Send()
s.DeliverNow()
s.Logoff()
except:
logfile.write("Couldn't write email")
#===
So, I'm coming to a conclusion that it is not possible to send emails
while logged off.
More information about the Tutor
mailing list