Why is OL not keeping the correct sender account?

Status
Not open for further replies.
K

Kukulkan

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(ItemID)

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
 
K

Kukulkan

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
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
GaryW88 2016 Archiving IMAP keeping mail on Gmail Server Using Outlook 1
broadbander Needing help with reply/reply all while keeping attachments and adding a new CC recipient. Outlook VBA and Custom Forms 5
Brendan Keeping Outlook contacts on PC after signing out of icloud Using Outlook 1
Commodore Keeping two computers in sync Using Outlook 5
R Forwarding and keeping Original intact Using Outlook 3
S Copying multiple messages to folders and keeping date/time detail Using Outlook 1
B Keeping an Outlook window on top (2010) Using Outlook 6
S Password is not keeping my mails secure? Using Outlook.com accounts in Outlook 0
L Keeping emails showing in yahoo mail after I use Outlook 2007 Using Outlook 2
Q keeping meeting invites in Outlook inbox Using Outlook 1
R Outlook 2010 - Keeping the e-mail that has an appointment in it. Using Outlook 2
L Keeping Outlook contact, documents and favourites from trial programs installed. cant access these files to export them. Using Outlook 2
G Consolidate two exchange servers from seperate forests into one while keeping forests intact Exchange Server Administration 4
R keeping meeting invites in inbox Using Outlook 5
T Using Outlook 2007 in two locations and keeping the messages in both places. Using Outlook 3
D Moving Exchange Server 2010 to New Hardware and Keeping the Same Server Name Exchange Server Administration 10
L Keeping Track Of Read Receipts Using Outlook 6
R keeping track of custom settings for com add-ins Outlook VBA and Custom Forms 1
L Correct E-Mail Pulling Wrong Mail Using Outlook 3
L Email with correct To address but displaying name of a related person Using Outlook 0
J Sent Items Folder NOT Showing Correct From Email Address Using Outlook 0
T Outlook 2010 Correct way to map multiple contact fields Using Outlook 4
witzker Correct Format of custom Yes/No Checkboxes Outlook VBA and Custom Forms 0
Fozzie Bear Correct Method to set up Outlook.com accounts as Exchange Using Outlook.com accounts in Outlook 7
Thorsten show the correct calendar on start Outlook VBA and Custom Forms 5
R Correct a wrong csv export file from WLM 2012 Using Outlook 0
R VBScript Sendmail not selecting correct 'from' address Outlook VBA and Custom Forms 3
I Large emails not sent from correct account Using Outlook 0
J Importing to the correct calendar from Excel 2010 to Outlook 2010 Outlook VBA and Custom Forms 2
A phone numbers fields in BCM are not correct BCM (Business Contact Manager) 3
E Getting Outlook full name correct with AddressLayout Using Outlook 1
D Journal problem recording correct phone number Using Outlook 7
P correct public folder migration exchange 2003 to 2010 Exchange Server Administration 1
B Outlook 2010 asking for password constantly, won't accept correct one Using Outlook 5
M help correct code Using Outlook 0
J Correct settings for send/receive groups w/Exchange Using Outlook 3
A Need method to rapidly correct telephone contact telephone number formatting Using Outlook 1
D How to correct Outlook Connector Live ID Using Outlook.com accounts in Outlook 1
D appointments on To Do Bar don't reflect the correct Calendar Using Outlook 3
M Auto-correct Contact fields' formatting? Using Outlook 7
B Trying to find & run Scanpst.exe. Outlook can't log onto server. Have removed update KB2412171 & it did not correct problem. Have done a resto Using Outlook 2
H Correct e-mail address format in address book in GAL Exchange Server Administration 3
L When I click on links within Outlook they always go to my website's homepage instead of going to the correct url. Using Outlook 2
D Sending mail from an IMAP account does not store sent mail on the correct folder Using Outlook 1
A The auto correct feature doesn't work on all the programs word, outlook, etc. Also when I try to us Using Outlook 1
R Way to correct the window in focus when creating a task from email? Using Outlook 1
S __Below are the errors listed in my Outlook Send?Receive. How do I correct them?__ Using Outlook 1
N I can't get my out of office reply to work. I know it is set up correct. Please help!! Using Outlook 2
T outlook auto correct Using Outlook 5
S Outlook 2010 losing correct logon details when connecting to Exchange 2010. Using Outlook 3
Similar threads


















































Top