![]() |
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. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
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 |