• Subject: Re: Recipients email address
  • Author: tintin pranto
  • Date: 02 Dec 2010
  • References:
Hello everyone, I like this blog as i am looking for something similar code for the problem i am facing. We are thinking of a rule to check if incoming mail has my name or the distribution list (where i am a member) is in To or Cc and based on that send that email to a certain folder. existing rules doesn't define the distribution list in To or Cc. I am asking if anyone of you can help me to code a rule to find a certain distribution list is in To or Cc and based on that send that email to certain folder. Thank you.

> On Friday, January 30, 2009 10:36 AM VebKo wrote:

> Hi
>
> I have problems reading email address from all recipients on my current
> mail, it is no problem to get the names for all the recipients, but... email
> adress......
>
> I'm using the following code to get names, but need som tip's on how to get
> the mail address for this persons...
>
> I'm using Redemtion :-)
>
> ----------------------------------------------------------------------------------------
> Set Application = CreateObject("Outlook.Application")
> Set sInspector = CreateObject("Redemption.SafeInspector")
> sInspector.Item = Application.ActiveInspector
>
> NoPers = sInspector.CurrentItem.Recipients.Count
> For t = 1 To NoPers
> Select Case sInspector.CurrentItem.Recipients.Item(t).Type
> Case 1
> Debug.Print "to=" &
> myinspector.CurrentItem.Recipients.Item(t)
> Case 2
> Debug.Print "cc=" &
> myinspector.CurrentItem.Recipients.Item(t)
> End Select
> Next t
>
>
> --
> Regards
> OD


>> On Friday, January 30, 2009 12:17 PM Dmitry Streblechenko wrote:

>> Recipient.Item(index) returns a Recipient object, which exposes a few
>> properties, such as Name, Address, Type, etc. Your code reads only the
>> default Recipient object property, which happens to be Name.
>> Use
>> myinspector.CurrentItem.Recipients.Item(t).Address
>>
>> As a side note, multiple dot notation is bad. Cache both the Recipients
>> colleciton and the Recipient object.
>> SEcondly, you are emoving drecipients in the loop, which decreases the
>> number of items in teh colleciton.
>> Loop from Count down do to 1 (step - 1) instead.
>>
>> --
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>> -
>> "VebKol" <VebKol@discussions.microsoft.com> wrote in message
>> news:991CEB3F-E565-45F3-905F-B5FDDAE71889@microsoft.com...


>>> On Friday, January 30, 2009 1:33 PM VebKo wrote:

>>> Point taken :-),
>>> but how do I resolve this mail address :
>>>
>>> /O=NET/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=PETER.PAN
>>>
>>>
>>> --
>>> Regards
>>> OD
>>>
>>>
>>> "Dmitry Streblechenko" wrote:


>>>> On Friday, January 30, 2009 3:18 PM Ken Slovak - [MVP - Outlook] wrote:

>>>> Recipient.AddressEntry.SmtpAddress, bearing in mind Dmitry's warning about
>>>> using compound dot operators. You'd need a SafeRecipient or RDORecipient
>>>> object for that though, the Outlook AddressEntry object doesn't have an
>>>> SmtpAddress property.
>>>>
>>>> --
>>>> 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
>>>>
>>>>
>>>> "VebKol" <VebKol@discussions.microsoft.com> wrote in message
>>>> news:731EF1E1-077A-4EA1-9782-6C6C5878F7C4@microsoft.com...


>>>>> On Friday, January 30, 2009 3:28 PM VebKo wrote:

>>>>> I am not that skilled....
>>>>>
>>>>> Do you have any example code ?
>>>>>
>>>>>
>>>>> --
>>>>> Regards
>>>>> OD
>>>>>
>>>>>
>>>>> "Ken Slovak - [MVP - Outlook]" wrote:


>>>>>> On Friday, January 30, 2009 4:33 PM Ken Slovak - [MVP - Outlook] wrote:

>>>>>> If the item in the Inspector is a mail item then something like this:
>>>>>>
>>>>>> Dim oMail As Outlook.MailItem
>>>>>> Dim rMail As Redemption.SafeMailItem
>>>>>> Dim rRecips As Redemption.SafeRecipients
>>>>>> Dim rRecip As Redemption.SafeRecipient
>>>>>> Dim rAE As Redemption.SafeAddressEntry
>>>>>> Dim sAddy As String
>>>>>>
>>>>>> Set oMail = Inspector.CurrentItem
>>>>>> Set rMail = CreateObject("Redemption.SafeMailItem")
>>>>>> rMail.Item = oMail
>>>>>> Set rRecips = rMail.Recipients
>>>>>> Set rRecip = rRecips.Item(1)
>>>>>> Set rAE = rRecip.AddressEntry
>>>>>> sAddy = rAE.SmtpAddress
>>>>>> MsgBox sAddy
>>>>>>
>>>>>> --
>>>>>> 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
>>>>>>
>>>>>>
>>>>>> "VebKol" <VebKol@discussions.microsoft.com> wrote in message
>>>>>> news:46D44CCB-661A-4F06-BCB9-48C42EF163A3@microsoft.com...


>>>>>>> On Friday, January 30, 2009 4:43 PM VebKo wrote:

>>>>>>> Sorry, but I get a error when compiling/running this :
>>>>>>>
>>>>>>> at this line :
>>>>>>> Dim rAE As Redemption.SafeAddressEntry
>>>>>>>
>>>>>>> Error : User-defined type not defined
>>>>>>>
>>>>>>> You know why ?
>>>>>>> --
>>>>>>> Regards
>>>>>>> OD
>>>>>>>
>>>>>>>
>>>>>>> "Ken Slovak - [MVP - Outlook]" wrote:


>>>>>>>> On Sunday, February 01, 2009 1:06 PM Ken Slovak - [MVP - Outlook] wrote:

>>>>>>>> Because it should have been Dim rAE As Redemption.AddressEntry.
>>>>>>>>
>>>>>>>> It just goes to show that I shouldn't write code off the top of my head, and
>>>>>>>> that you should look at the Object Browser :)
>>>>>>>>
>>>>>>>> --
>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>> "VebKol" <VebKol@discussions.microsoft.com> wrote in message
>>>>>>>> news:A7E62480-60C8-4F03-9F29-37A16217FECE@microsoft.com...


>>>>>>>>> On Sunday, February 01, 2009 1:22 PM VebKo wrote:

>>>>>>>>> Thank you very much !
>>>>>>>>> I'ts working now !!!
>>>>>>>>>
>>>>>>>>> it is extreamly good to have this kind of feedback from persons like you :-)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> But now I faced a new problem :-( .....
>>>>>>>>>
>>>>>>>>> ref : Reading SMTP address from Exchange Sender mail address
>>>>>>>>> ..... reading SMPT address form sender e-mail..
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Regards
>>>>>>>>> OD
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> "Ken Slovak - [MVP - Outlook]" wrote:


>>>>>>>>>> On Friday, July 16, 2010 10:48 AM fareed khan wrote:

>>>>>>>>>> I am using the above code in application_item send to read email address mentioned in 'to'
>>>>>>>>>>
>>>>>>>>>> i want display a message which shows the email addresses of the receipients in 'to' before sending the mails.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Dim oMail As Outlook.MailItem
>>>>>>>>>>
>>>>>>>>>> Dim rMail As Redemption.SafeMailItem
>>>>>>>>>>
>>>>>>>>>> Dim rRecips As Redemption.SafeRecipients
>>>>>>>>>>
>>>>>>>>>> Dim rRecip As Redemption.SafeRecipient
>>>>>>>>>>
>>>>>>>>>> Dim rAE As Redemption.AddressEntry
>>>>>>>>>>
>>>>>>>>>> Dim sAddy As String
>>>>>>>>>>
>>>>>>>>>> Set oMail = Inspector.CurrentItem
>>>>>>>>>>
>>>>>>>>>> Set rMail = CreateObject("Redemption.SafeMailItem")
>>>>>>>>>>
>>>>>>>>>> rMail.Item = oMail
>>>>>>>>>>
>>>>>>>>>> Set rRecips = rMail.Recipients
>>>>>>>>>>
>>>>>>>>>> Set rRecip = rRecips.Item(1)
>>>>>>>>>>
>>>>>>>>>> Set rAE = rRecip.AddressEntry
>>>>>>>>>>
>>>>>>>>>> sAddy = rAE.SmtpAddress
>>>>>>>>>>
>>>>>>>>>> MsgBox sAddy
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> End Sub
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Rgrds,
>>>>>>>>>>
>>>>>>>>>> FK


>>>>>>>>>> Submitted via EggHeadCafe
>>>>>>>>>> Microsoft ASP.NET For Beginners
>>>>>>>>>> http://www.eggheadcafe.com/training-topic-area/ASP-NET/7/ASP.aspx
02 Dec 2010Re: Recipients email address.tintin pranto
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)