I am tryign to write a macro for outlook on send out of mail that checks ot see if th recipient is an internal or external. If it is an internal I want it to put it as a delayed delivery and not send until 4PM no matter what day. I have it kinda working just canceling the message if internal.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim recips As Outlook.Recipients
Dim recip As Outlook.Recipient
Dim pa As Outlook.PropertyAccessor
Const PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E"
Set recips = Item.Recipients
For Each recip In recips
Set pa = recip.PropertyAccessor
If InStr(LCase(pa.GetProperty(PR_SMTP_ADDRESS)), "@mycompany.net") > 0 Then
If MsgBox("Send mail to internal address?", vbYesNo + vbQuestion +
vbMsgBoxSetForeground, "MY COMPANY E-Mail Policy Notice") = vbNo Then
Cancel = True
I tried adding in some subs but it failed saying email already in progress.