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.
Similar threads
Thread starter Title 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
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 5
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
S Send receive with ATT returns this error: 0x800CCC92 . My password is correct. Using Outlook 2
E Some question if I understand user properties correct Outlook VBA and Custom Forms 3
E Some question if I understand user properties correct Outlook VBA and Custom Forms 3
S Correct way to Identify is Mail is opened in Edit Mode Outlook VBA and Custom Forms 1
Q Need advice for correct event Outlook VBA and Custom Forms 1
R Capture Sender's Display name and Address Outlook VBA and Custom Forms 3
T Junk Email does not get added to the Blocked Sender List Using Outlook 0
M How create a Rule to filter sender's email with more that one @ sign Using Outlook 1
F Junk Email does not get added to the Blocked Sender List Using Outlook 4
U Outlook 2016 Outlook 2016 sender name Using Outlook 1
C Macro to extract sender name & subject line of incoming emails to single txt file Outlook VBA and Custom Forms 3
Terry Sullivan Sender's Name Doesn't Appear in the From Field on Outlook 365/IMAP Using Outlook 2
K Use VBA to find Sender and Recipient from Microsfot 365 Journaled Email Items Outlook VBA and Custom Forms 3
Terry Sullivan Sender Field Displays My E-Mail Address, Not My Name Using Outlook 1
J Autoreply email recieved from specific sender after deleting some text from body. Using Outlook 0
D Reply with a template loose the sender's embedded image Outlook VBA and Custom Forms 0
J Outlook 2016 How tell Outlook not to trust sender? Using Outlook 1
M Screen Scrape Sender IP Address Outlook VBA and Custom Forms 6
S Meeting Invite arrives from Wrong ("send-as") Sender Using Outlook 1

Similar threads

Top