如何将mailitem.sender设置为帐户的邮箱..
每个帐户可以有多个邮箱。我可以访问所有smtp帐户,但不能将他们的邮箱设置为mailitem.sender。
我们可以使用Outlook.Session.Folders访问的outlook邮箱
发布于 2015-07-01 19:21:48
MailItem类的SendUsingAccount属性允许设置一个Account对象,该对象表示发送MailItem所使用的帐户。例如:
Sub SendUsingAccount()
Dim oAccount As Outlook.account
For Each oAccount In Application.Session.Accounts
If oAccount.AccountType = olPop3 Then
Dim oMail As Outlook.MailItem
Set oMail = Application.CreateItem(olMailItem)
oMail.Subject = "Sent using POP3 Account"
oMail.Recipients.Add ("someone@example.com")
oMail.Recipients.ResolveAll
oMail.SendUsingAccount = oAccount
oMail.Send
End If
Next
End Sub https://stackoverflow.com/questions/31159211
复制相似问题