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 » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Why is OL not keeping the correct sender account?



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 7th 09, 03:00 PM posted to microsoft.public.outlook.program_addins
Kukulkan[_2_]
external usenet poster
 
Posts: 9
Default Why is OL not keeping the correct sender account?

Hello,

I like to manipulate a mail before sending. But after modifying
(subject, message, attachments), the e-mail gets allways sent using
the default account and not using the selected account (VB6 COM AddIn
using Redemption Objects):

To trace the problem I made a little routine to find out which sender
currently is selected for a given Mailobject:

Public Function GetMailSenderAccountName(ByRef Mailobject As Object)
Dim RDOSession As Redemption.RDOSession
Dim RDOMessage As Redemption.RDOMail

Mailobject.Save ' needed to get an EntryID
Set RDOSession = CreateObject("Redemption.RDOSession")
RDOSession.MAPIOBJECT = Application.Session.MAPIOBJECT
Set RDOMessage = RDOSession.GetMessageFromID(Mailobject.EntryID)

GetMailSenderAccountName = RDOMessage.Account.Name

End Function

Using the following code, I get allways the correct account:

Set MyItem = ConnectClass.VBInstance.Session.GetItemFromID(Item ID)
Debug.Print "Before sending: " & GetMailSenderAccountName(MyItem) -
"smtp.correct.com"
RedemptionMail.Item = MyItem ' use redemption objects here (needed?)
RedemptionMail.Send
Debug.Print "After sending: " & GetMailSenderAccountName(MyItem) -
"smtp.correct.com"

But the mail has been sent using the wrong account (default account).
The "smtp.correct.com" account is working great, if I do not use the
methods above. Same problem using OL2003 and OL2007.

What can I do to keep the selected account for sending?

Thank you,

Kukulkan
Ads
  #2  
Old October 8th 09, 08:53 AM posted to microsoft.public.outlook.program_addins
Kukulkan[_2_]
external usenet poster
 
Posts: 9
Default Why is OL not keeping the correct sender account?

Hello,

I found a solution to this problem. I simply needed to set the Account
again to let Outlook do what I want. The following way helped me out:

Public Function SendUsingRDO(ByRef Mailobject As Object)
Dim RDOSession As Redemption.RDOSession
Dim RDOMessage As Redemption.RDOMail
Dim RDOAccount As Redemption.RDOAccount

' save the mail, in case it is not saved until now
Mailobject.Save

Set RDOSession = CreateObject("Redemption.RDOSession")
RDOSession.MAPIOBJECT = Application.Session.MAPIOBJECT
Set RDOMessage = RDOSession.GetMessageFromID(Mailobject.EntryID)

Set RDOAccount = RDOMessage.Account ' get account

If Not RDOAccount Is Nothing Then
' set the account again
RDOMessage.Account = RDOSession.Accounts(RDOAccount.Name)
RDOMessage.Save
End If
RDOMessage.Send
SendUsingRDO = True
End Function

At first I read the Account that is used (reading). Upon this, I set
this value again (writing). Now calling the .Send method forces
Outlook to use the account that has been set but ignored. Strange...

Kukulkan
 




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
multiple sender email address for account fileman Outlook - General Queries 5 October 10th 07 05:55 PM
Macro to create new email message with different account as sender Brian Beck Outlook and VBA 1 March 21st 07 11:15 PM
account password is correct but it's never accepted hence no mail Lynsay Outlook - Installation 2 September 4th 06 10:44 PM
can i group emails by sender & by number of items for each sender baffled_by_tech Outlook - Using Contacts 2 March 5th 06 08:27 PM
Junk mail: How to create a button for "Add sender to blocked sender list" Nananana Outlook - General Queries 2 February 2nd 06 12:37 PM


All times are GMT +1. The time now is 08:40 AM.


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.