MAcro - Need help in getting the recipients in to filed / cc field toput in an array

S

Shreekanth Murali

This is the macro to stop sending without a subject as well as to warn the user whn he sends to the distribution list that starts with "#"
However this code detects the email addresses in TO / CC as one single string.

For eg if i have

shreekanth Murali; #IN - distribution

then it detects "shreekanth murali; #in - distribution" and not warning the presence of a distributon list in TO field... Im a beginner please lemme know how can i do it


Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)

Dim strSubject As String

strSubject = item.Subject

If Len(Trim(strSubject)) = 0 Then

Prompt$ = "Subject is Empty. Are you sure you want to send the Mail?"

If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for Subject") = vbNo Then

Cancel = True

End If

End If


Dim a

Dim b





a = Mid(item.To, 1, 1)

If a = "#" Then

Prompt$ = "You are about to send an email to the distribution list " & item.To

If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Recipient is a distribution list") = vbNo Then

Cancel = True

End If



End If


End Sub


Submitted via EggHeadCafe - Software Developer Portal of Choice
CSS Stylesheet Sampler Script
http://www.eggheadcafe.com/tutorial...0-64466ee722bc/css-stylesheet-sampler-sc.aspx
 
D

Dmitry Streblechenko

Instead of using To/CC/BCC properties, loop through all the recipients in
the MailItem.Recipients collection.

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 
S

Shreekanth Murali

Can you please guide me by giving me an example how to use this.... I am sorry i need to agree that i have just started to learn... i need your help please... we are gonna apply this for our people in my company...



Dmitry Streblechenko wrote:

Instead of using To/CC/BCC properties, loop through all the recipients inthe
18-Dec-09

Instead of using To/CC/BCC properties, loop through all the recipients i
the MailItem.Recipients collection

-
Dmitry Streblechenko (MVP
http://www.dimastr.com
OutlookSpy - Outlook, CD
and MAPI Developer Too

<Shreekanth Murali> wrote in message

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
ASP.NET Digest Authentication Against Database
http://www.eggheadcafe.com/tutorial...af-8a9a5c91c0d6/aspnet-digest-authentica.aspx
 
S

Shreekanth Murali

item.recipients.Count gives me number of recipients in the mail. How can i get the details of that . What should i user.

eg: I have three email address in to field and for testing purpose i wrote msgbox(item.recipients.count)
and this gave me 3 in the msgbox. Now how can get the recipients? i can create a loop but what property should i use to extract this ?

iam using O2k3



Shreekanth Murali wrote:

example please
19-Dec-09

Can you please guide me by giving me an example how to use this.... I am sorry i need to agree that i have just started to learn... i need your help please... we are gonna apply this for our people in my company...

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
Toward Viable CAPTCHA Alternatives
http://www.eggheadcafe.com/tutorial...c-a34cd08623e8/toward-viable-captcha-alt.aspx
 
S

Shreekanth Murali

Hey I found it


its item.recipients.item(i).AddressEntry


THANKS A LOT FOR YOUR INFORMATION.



Shreekanth Murali wrote:

item.recipients.Count
20-Dec-09

item.recipients.Count gives me number of recipients in the mail. How can i get the details of that . What should i user.

eg: I have three email address in to field and for testing purpose i wrote msgbox(item.recipients.count)
and this gave me 3 in the msgbox. Now how can get the recipients? i can create a loop but what property should i use to extract this ?

iam using O2k3

Previous Posts In This Thread:


Submitted via EggHeadCafe - Software Developer Portal of Choice
axWebBrowser1.Navigate Auto Page Loader In A Real Browser
http://www.eggheadcafe.com/tutorial...4f-4a6dbf0c2d91/axwebbrowser1navigate-au.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top