Send Email From Specific Outlook Account Via Python? -


i had code written email lab users whenever processes had finished running. sent gmail account, using smtp.

however, supervisor wants mail sent official department address, means have use outlook , mapi. i've had account created want email originate regardless of lab machine job being run on. problem can email send local outlook account, , not of lab machines have local account.

import win32com.client win32 outlook = win32.dispatch('outlook.application') mail = outlook.createitem(0) mail.to = 'user@domain.com' mail.subject = 'message subject' mail.body = 'message text. message text' mail.send 

surely there's way specify username/password/server want email sent from?

the outlook object model doesn't provide configuring profiles. however, if have account configured in outlook may find sendusingaccount property of mailitem class helpful. allows set account object represents account under mailitem sent.

you may find following links helpful:


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -