Need to switch accounts in outlook using python for sending email using other account

给你一囗甜甜゛ 提交于 2019-12-25 00:15:31

问题


I have the following code

import win32com.client as win32
outlook = win32.Dispatch('outlook.application')
mail = outlook.CreateItem(0)
mail.To = 'madanraj.c@sss.com;
mail.Subject = 'Daily Backlog'
mail.Send()

I have two accounts in outlook and i installed redemption too, but struck how to switch account

i saw vb code and i cant convert to python code

set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Accounts = Session.Accounts
for each Account in Accounts
  Debug.Print Account.Name
next

回答1:


Set MailItem.SendUsingAccount property.



来源:https://stackoverflow.com/questions/52202852/need-to-switch-accounts-in-outlook-using-python-for-sending-email-using-other-ac

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!