?
Solved

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

Posted on 2008-01-26
6
Medium Priority
?
752 Views
Last Modified: 2013-12-26
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
0
Comment
Question by:algecoadh
  • 3
  • 3
6 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 20750298
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
 

Author Comment

by:algecoadh
ID: 20752769
Can you pls supply the code which precedes the one you have sent???
Thanx.
0
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 20764968
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 

Author Closing Comment

by:algecoadh
ID: 31425279
Works like a charm...;-)
Tbanx!
0
 

Author Comment

by:algecoadh
ID: 20765767
Works like a charm ;-)
THANX.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 20766491
You're welcome.  Glad I could help.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With so many activities to perform, Exchange administrators are always busy in organizations. If everything, including Exchange Servers, Outlook clients, and Office 365 accounts work without any issues, they can sit and relax. But unfortunately, it…
A few solutions to a problem some of us have been having when trying to add Hostgator email accounts to Outlook 2016 (will probably work with Outlook 2013 as well).
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

592 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question