Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / March 2008

Tip: Looking for answers? Try searching our database.

Setting account for an outgoing email

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Markus - 19 Jul 2007 22:10 GMT
I am using OLE to call outlook in my app to send email.  I see many
properties I can set, but not one that I can use to set the account (e.g.,
send via Markus@My1.com, or send via Markus@My2.com, etc.) that will be used
to send the email.  I have 2 accounts set up in outlook now that I could
access.

Can anyone help on how outlook sets this account and how I would do it
programmatically before I send the email?

Many thanks for any ideas on this,
Mark
Dmitry Streblechenko - 20 Jul 2007 01:39 GMT
1. OOM in Outlook 2007 - MailItem.SendUsingAccount property
2. Extended MAPI (C++/Delphi only) - use IOlkAccountMgr to read the account
names/ids and set them on the message (look at a message with an account
info set using OutlookSpy - click IMessage)
3. <plug> RDOMail.Account property - see
http://www.dimastr.com/redemption/rdo/RDOMail.htm </plug>

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

>I am using OLE to call outlook in my app to send email.  I see many
> properties I can set, but not one that I can use to set the account (e.g.,
[quoted text clipped - 8 lines]
> Many thanks for any ideas on this,
> Mark
JHoep - 29 Mar 2008 04:46 GMT
Following along this logic, is there a way to use MailItem.SendUsingAccount
that will attempt to send the email via one account, but if that fails, to
use a second account that is set up in Outlook?
I currently have two accounts, one which works when I have my laptop at work
(through one SMTP server) and one which works at home (through a different
SMTP server).  I am trying to avoid having to manually select the account
every time I am at the non-default account location.
Thanks for any assistance you can provide.
Jason

> 1. OOM in Outlook 2007 - MailItem.SendUsingAccount property
> 2. Extended MAPI (C++/Delphi only) - use IOlkAccountMgr to read the account
[quoted text clipped - 20 lines]
> > Many thanks for any ideas on this,
> > Mark
SvenC - 29 Mar 2008 10:30 GMT
HI JHoep,

> Following along this logic, is there a way to use
> MailItem.SendUsingAccount that will attempt to send the email via one
> account, but if that fails, to use a second account that is set up in
> Outlook?

I guess the problem is that using the wrong account does not result
in a failure but will just keep the mail in the outbox until the smtp server
gets available, correct?

> I currently have two accounts, one which works when I have my laptop
> at work (through one SMTP server) and one which works at home
> (through a different SMTP server).  I am trying to avoid having to
> manually select the account every time I am at the non-default
> account location.

You might need to check the availability of some other resource, e.g.
a file on a network share which is only available when you are in your
work network. That should help to figure out which account to use.

--
SvenC
JHoep - 29 Mar 2008 13:10 GMT
Ok, I definitely can check for the existence of a network drive or other
shared file that would be accessible only at work.  But how do I do that?  
What would be the basic commands/syntax to have Outlook do the check and then
pick the account to send the email from (ideally this happens behind the
scenes when the "Send" button is pressed).
Thanks.
Jason

> HI JHoep,
>
[quoted text clipped - 19 lines]
> --
> SvenC
SvenC - 29 Mar 2008 14:36 GMT
Hi JHoep,

> Ok, I definitely can check for the existence of a network drive or
> other shared file that would be accessible only at work.  But how do
> I do that? What would be the basic commands/syntax to have Outlook do
> the check and then pick the account to send the email from (ideally
> this happens behind the scenes when the "Send" button is pressed).

I thought you wanted to do some macro programming.

When you want Outlook to automatically choose the accout you could
add some code in the ItemSend event of Outlook.Application. I am not
sure if you can change the account at this point but you can at least try
it.

--
SvenC
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.