Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Sending a Mail merge from Mutilpe Email Accounts


Sending a Mail merge from Mutilpe Email Accounts

Author
Message
KaosTheory
KaosTheory
Forum God
Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)Forum God (1.1K reputation)

Group: Forum Members
Posts: 7, Visits: 31
Hey All

I have a dilema. I currently have Outlook 2003 which has mutiple mailboxes. I have created a Macro in Word 2003 that sends out emails after i run a mail merge. Problem is I have multiple mailboxes and each mail merge needs to be sent from a different email account depending on a field in the mail merge.

Anyone have any idea how I how to send an email from a certain address.

EG: Merge field 'a' needs to be sent from email adress a@a.com and if merge field has 'b' in it then it needs to be sent from b@b.com

How do I get it to to send from these mailboxes as if it was from these fields and not "on behalf of"

Thanks

KaosTheory

BenjiB
BenjiB
Forum God
Forum God (680 reputation)Forum God (680 reputation)Forum God (680 reputation)Forum God (680 reputation)Forum God (680 reputation)Forum God (680 reputation)Forum God (680 reputation)Forum God (680 reputation)Forum God (680 reputation)

Group: Forum Members
Posts: 2, Visits: 3
I recently had the same question and found this solution.
I hope it helps.

Dim oAccount As Outlook.Account
dim SentFrom As String

if whatever you are checking is true then
    SentFrom = emailaddress1
else
    SentFrom = emailaddress2
end if

' Selected Email Account must be a valid Email Account on the PC you are sending the Emails from.

For Each oAccount In Application.Session.Accounts
    If oAccount.SmtpAddress = SentFrom Then
        mailMail.SendUsingAccount = oAccount
        Exit For
    End If
Next
If mailMail.SendUsingAccount Is Nothing Then
    msgbox("Account Not Found")
end if

Ashutosh
Ashutosh
Forum God
Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)Forum God (1K reputation)

Group: Forum Members
Posts: 3, Visits: 2
Dim oAccount As Outlook.Account

dim SentFrom As String



if whatever you are checking is true then

SentFrom = emailaddress1

else

SentFrom = emailaddress2

end if



' Selected Email Account must be a valid Email Account on the PC you are sending the Emails from.



For Each oAccount In Application.Session.Accounts

If oAccount.SmtpAddress = SentFrom Then

mailMail.SendUsingAccount = oAccount

Exit For

End If

Next

If mailMail.SendUsingAccount Is Nothing Then

msgbox("Account Not Found")

end if

marketing return on investment

Acai Berry Juice Wikipedia Fruit Berries



GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search