0

アカウントのメールボックスとして mailitem.sender を設定する方法..

各アカウントは複数のメールボックスを持つことができます。すべての smtp アカウントにアクセスできますが、メールボックスを mailitem.sender として設定できません

Outlook.Session.Folders を使用してアクセスできる Outlook メールボックス

4

1 に答える 1

0

MailItem クラスのSendUsingAccountプロパティを使用すると、MailItem を送信するアカウントを表す Account オブジェクトを設定できます。例えば:

 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 
于 2015-07-01T11:21:47.897 に答える