A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Choose the email account when sending emails via VBA



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old January 12th 08, 09:30 AM posted to microsoft.public.outlook.program_vba
Catalin
external usenet poster
 
Posts: 15
Default Choose the email account when sending emails via VBA

Hi everybody,

As I wrote in an earlier post, I have 3 email accounts and use OL2003.
I have several rules which replies automatically to different senders using
different templates. The problem is that the reply uses the default email
account when sending even though I get the initial email through another
account.

The question is: can I somehow determine the incoming account from the
messages received and then reply automatically through the same account? I
hope this can be done with VBA.

Thanks again in advance for your kind reply.

Catalin
  #2  
Old January 14th 08, 10:20 AM posted to microsoft.public.outlook.program_vba
Gauthier
external usenet poster
 
Posts: 4
Default Choose the email account when sending emails via VBA

To specify the From: field using VBA, you can use the MailItem properties
..SenderEmailAddress or .SenderName. You will first have to get the correct
address by searching your 3 addresses in the To: and Cc: field in the
original email using properties .CC and .To.
  #3  
Old January 14th 08, 02:41 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Choose the email account when sending emails via VBA

Both of the properties you mention, along with SenderEmailType are read-only
for the Outlook object model and cannot be set in code.

You can use SentOnBehalfOfName in the Outlook object model.

If you are using Extended MAPI or Redemption (www.dimastr.com/redemption)
you can set SenderName or SenderEmailAddress, but not using the Outlook
object model.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Gauthier" wrote in message
...
To specify the From: field using VBA, you can use the MailItem properties
.SenderEmailAddress or .SenderName. You will first have to get the correct
address by searching your 3 addresses in the To: and Cc: field in the
original email using properties .CC and .To.


  #4  
Old January 14th 08, 05:23 PM posted to microsoft.public.outlook.program_vba
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Choose the email account when sending emails via VBA

You can also set the account in Redemption using the RDOMail.Account
property - http://www.dimastr.com/redemption/rd...htm#properties

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

"Ken Slovak - [MVP - Outlook]" wrote in message
...
Both of the properties you mention, along with SenderEmailType are
read-only for the Outlook object model and cannot be set in code.

You can use SentOnBehalfOfName in the Outlook object model.

If you are using Extended MAPI or Redemption (www.dimastr.com/redemption)
you can set SenderName or SenderEmailAddress, but not using the Outlook
object model.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Gauthier" wrote in message
...
To specify the From: field using VBA, you can use the MailItem properties
.SenderEmailAddress or .SenderName. You will first have to get the
correct
address by searching your 3 addresses in the To: and Cc: field in the
original email using properties .CC and .To.




  #5  
Old January 14th 08, 06:47 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Choose the email account when sending emails via VBA

And in Outlook 2007 you can use the MailItem.SendUsingAccount property.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Dmitry Streblechenko" wrote in message
...
You can also set the account in Redemption using the RDOMail.Account
property - http://www.dimastr.com/redemption/rd...htm#properties

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


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to choose which account to send mail Deon Outlook - General Queries 5 February 7th 07 12:25 PM
Outlook 2003 not sending emails for one account tdmoon Outlook - General Queries 4 January 15th 07 06:11 PM
Outlook 2003 not sending emails for one account tdmoon Outlook - General Queries 0 January 13th 07 07:53 PM
Outlook 2003 not sending emails for one account tdmoon Outlook - General Queries 0 January 13th 07 07:51 PM
sending emails using same account Kishore Outlook - General Queries 4 January 4th 07 04:51 PM


All times are GMT +1. The time now is 02:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.