Sending email (outlook2000 / vb6) - using MAPI - with secondary email accounts!

I have multiple email accounts in Outlook 2000 (one of them is set as default).
Using VB6 / MAPI, i want to send email to different recipients using different
accounts - which are configured with different outgoing mail servers (smtp).
How to do this?

If not possible with Mapi,  any other solution???
Thanx
algecoadhAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
Hi, algecoadh.

It is possible to do this with something like the code below.  This is code I've used in Outlook.  Modify it as needed to work in VB.


Set olkSendThroughBtn = Application.ActiveInspector.CommandBars("Standard").Controls(3)
'Replace 2 on the line below with a number corresponding to the position of the account to send through in the list of accounts
Set olkSendAccount = olkSendThroughBtn.Controls(2)
olkSendAccount.Execute

Open in new window

0
algecoadhAuthor Commented:
Can you pls supply the code which precedes the one you have sent???
Thanx.
0
David LeeCommented:
Sure, here it is.
Sub CreateNewMessage()
    Dim olkMessage As MailItem, _
        olkSendThroughBtn As Object, _
        olkSendAccount As Object
    Set olkMessage = Application.CreateItem(olMailItem)
    olkMessage.Display
    Set olkSendThroughBtn = Application.ActiveInspector.CommandBars("Standard").Controls(3)
    'Change (2) on the following line to the position in the list of accounts that this account occupies
    Set olkSendAccount = olkSendThroughBtn.Controls(2)
    olkSendAccount.Execute
    Set olkSendAccount = Nothing
    Set olkSendTrhoughBtn = Nothing
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

algecoadhAuthor Commented:
Works like a charm...;-)
Tbanx!
0
algecoadhAuthor Commented:
Works like a charm ;-)
THANX.
0
David LeeCommented:
You're welcome.  Glad I could help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.