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

Use Redemption to get sender's email address



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 3rd 10, 01:27 AM posted to microsoft.public.outlook.program_addins
BVM
external usenet poster
 
Posts: 15
Default Use Redemption to get sender's email address

Hi:

I can get recipient's email by using Redemption:

Redemption.MAPIUtils utils = new Redemption.MAPIUtils();

utils.MAPIOBJECT = this.Application.Session.MAPIOBJECT;

int PrSMTPAddress = 0x39FE001E;

string AddresseeEmail = (string)utils.HrGetOneProp(mail.Recipients[1].AddressEntry.MAPIOBJECT, PrSMTPAddress);

Now I want to get sender's email address as well. mail.SenderEmailAddress is not always as simple as . How do I get the sender address? (mail is Outlook mailitem).



Thanks,



Danny Huang



Ads
  #2  
Old March 3rd 10, 04:00 PM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Use Redemption to get sender's email address

Instead of using the MAPIUtils object I'd recommend using an RDOMail object
for both tasks. You need an RDOSession object for that of course but I think
that's the better approach:

Redemption.RDOSession session = new Redemption.RDOSesison;
session.MAPIOBJECT = this.Application.Session.MAPIOBJECT;

// _missing is System.Reflection.Missing.Value, olMail is the Outlook mail
item
Redemption.RDOMail _mail = session.GetMessageFromID(olMail.EntryID,
_missing, _missing);

string recipEmail = _mail.Recipients[1].AddressEntry.SMTPAddress;
string senderEmail = _mail.Sender.SMTPAddress;

--
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


"BVM" wrote in message
...
Hi:

I can get recipient's email by using Redemption:

Redemption.MAPIUtils utils = new Redemption.MAPIUtils();

utils.MAPIOBJECT = this.Application.Session.MAPIOBJECT;

int PrSMTPAddress = 0x39FE001E;

string AddresseeEmail =
(string)utils.HrGetOneProp(mail.Recipients[1].AddressEntry.MAPIOBJECT,
PrSMTPAddress);

Now I want to get sender's email address as well. mail.SenderEmailAddress
is not always as simple as . How do I get the sender address?
(mail is Outlook mailitem).



Thanks,



Danny Huang



  #3  
Old March 3rd 10, 11:47 PM posted to microsoft.public.outlook.program_addins
BVM
external usenet poster
 
Posts: 15
Default Use Redemption to get sender's email address

Thanks, it works better.
"Ken Slovak - [MVP - Outlook]" wrote in message ...
Instead of using the MAPIUtils object I'd recommend using an RDOMail object for both tasks. You need an RDOSession object for that of course but I think that's the better approach:

Redemption.RDOSession session = new Redemption.RDOSesison;
session.MAPIOBJECT = this.Application.Session.MAPIOBJECT;

// _missing is System.Reflection.Missing.Value, olMail is the Outlook mail item
Redemption.RDOMail _mail = session.GetMessageFromID(olMail.EntryID, _missing, _missing);

string recipEmail = _mail.Recipients[1].AddressEntry.SMTPAddress;
string senderEmail = _mail.Sender.SMTPAddress;

--
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


"BVM" wrote in message ...
Hi:

I can get recipient's email by using Redemption:

Redemption.MAPIUtils utils = new Redemption.MAPIUtils();

utils.MAPIOBJECT = this.Application.Session.MAPIOBJECT;

int PrSMTPAddress = 0x39FE001E;

string AddresseeEmail = (string)utils.HrGetOneProp(mail.Recipients[1].AddressEntry.MAPIOBJECT, PrSMTPAddress);

Now I want to get sender's email address as well. mail.SenderEmailAddress is not always as simple as . How do I get the sender address? (mail is Outlook mailitem).



Thanks,



Danny Huang



  #4  
Old March 4th 10, 12:38 AM posted to microsoft.public.outlook.program_addins
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Use Redemption to get sender's email address

Although that was the lazy coder way. If the code will run in a loop or
where you need to release things as needed you're better off breaking this
line with all the dot operators into component parts with explicit objects
you can deterministically release as needed:

_mail.Recipients[1].AddressEntry.SMTPAddress

You'd instantiate explicit RDORecipients, RDORecipient and RDOAddressEntry
objects.

--
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


"BVM" wrote in message
...
Thanks, it works better.

 




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
I have to find the sender's email address win Outlook and VBA 1 January 28th 10 04:32 PM
"Sender's email address was rejected" Mike Aldrich Outlook Express 4 December 31st 07 12:14 AM
Error Number 0X800CCC78 Sender's email address rejected BKBKBK Outlook Express 6 November 23rd 07 09:54 AM
To rename outlook mail attachment to sender's email address sriramus Outlook and VBA 1 March 7th 06 06:41 PM
To rename outlook mail attachment to sender's email address sriramus Outlook and VBA 0 March 7th 06 04:43 PM


All times are GMT +1. The time now is 01:15 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.