Hi guys
I use the macro below to send a recurring email from an Outlook To-Do List task. The email is always sent from the "default" account. How can I modify the code so that the email is sent from a different account? I believe it can be done with "SendUsingAccount" but I'm not sure how to use it. I'd be grateful if a VBA expert could help with this.
Private Sub Application_Reminder(ByVal Item As Object)
Dim xMailItem As MailItem
Dim strbody As String
On Error Resume Next
If Item.Class <> OlObjectClass.olTask Then Exit Sub
If Item.Categories <> "Send Recurring Email" Then Exit Sub
Set xMailItem = Outlook.Application.CreateItem(olMailItem)
strbody = "<font face=Verdana><font size=2>" _
& "Weekly email event" 'Body text
With xMailItem
.Subject = "Weekly Email"
.To = "thisperson-at-someisp-dot-com"
.HTMLBody = strbody
'Not sure how to get this to work:
Set .SendUsingAccount = _
Session.Accounts.Item("thatperson-at-someotherisp-dot-com") 'Account to send from.
.Send
End With
Set xMailItem = Nothing
End Sub