How to Block from sending mail to public domain.

Status
Not open for further replies.

rancho

Member
Outlook version
Outlook 2010 64 bit
Email Account
hi,

I am new to forum, please accept my greetings.

Further, my team is using business mail id to communicate. Few days back I came to know that one of them have sent confidential files to his personal IDs (Public Domain) by mistake.

Please help me to block my team from sending any mails to any available public domain.
I am using OUTLOOK 2010.
 

Forum Admin

Senior Member
That is not really anything you can block in Outlook - the server usually handles it. Exchange server transport rules (including Office 365 exchange) can filter it. If you don't use exchange, you need to use your own smtp server and utility.

IRM (Individual rights management) would give you some control over the file but again, you need office 365 or an irm server.
 

rancho

Member
Outlook version
Outlook 2010 64 bit
Email Account
Hi,
I got resolution, we can put macro into it.

Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim recipients As Outlook.recipients
Dim recip As String
Dim i
 
'this code is encoded by Rochak Mehta
 
Set recipients = Item.recipients
For i = recipients.Count To 1 Step -1
recip$ = recipients.Item(i).Address
 
On Error Resume Next
Select Case LCase(recip)
 
Case "@gmail.com", "@ymail.com", "@yahoo.com", "@yahoo.in", "@yahoo.co.in", "@rediffmail.com"
 
Item.Send
 
Case Else
Prompt$ = "You are sending this to a Public Domain. Are you sure you want to send the Mail?"
 
If MsgBox(Prompt$, vbYesNo + vbCritical + vbMsgBoxSetForeground, "Check Address: By Rochak Mehta") = vbNo Then
Cancel = True
 
End If
End Select
 
Next
End Sub
 

rancho

Member
Outlook version
Outlook 2010 64 bit
Email Account
Hi Diane,

Thank you for the reply..

I have tried the suggestion, but its not working.
select Case instr(LCase(recip)) "Error doesn't letting me to close the last bracket".

Even my code lacking something somewhere as it prompts msg all the time whether I am sending it to a public domain(mentioned in the code) or business mail ID.

Could you please help me with this.

Thanks,
Rancho
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I'll test it, there might be a minor mistake that is easy to overlook. I use a similar macro so I know it should work.

Sent from my Venue 8 Pro 5830 using Tapatalk
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Btw, The code is configured to send to those domains and ask for all other domains.


Sent from my Venue 8 Pro 5830 using Tapatalk
 

Forum Admin

Senior Member
This works... instead of trying to use InStr, it uses an array and compares a string containing the recipients to the domains in the array. If you add domains, you'll need to raise the count for d - or let outlook calculate it using lbound and ubound.


Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim recipients As Outlook.recipients
Dim recip As Outlook.Recipient
Dim prompt As String
Dim domain As Variant
Dim strRecip As String
Dim i
Dim d As Long
'this code is encoded by Rochak Mehta
Set recipients = Item.recipients
  For i = recipients.Count To 1 Step -1
    Set recip = recipients.Item(i) '
    strRecip = recip & ";" & strRecip
Next
Debug.Print strRecip
On Error Resume Next

domain = Array("@gmail", "@ymail", "@yahoo", "@rediffmail")

For d = 0 To 3 'LBound(domain) To UBound(domain)
Debug.Print domain(d)
If InStr(LCase(strRecip), domain(d)) Then
    prompt$ = "You are sending this to a Public Domain. Are you sure you want to send the Mail?"
If MsgBox(prompt$, vbYesNo + vbCritical + vbMsgBoxSetForeground, "Check Address: By Rochak Mehta") = vbNo Then
Cancel = True
End If
Else
Item.Send
End If
Next d

End Sub
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
N Auto-complete - block select emails Using Outlook 3
L Block email signature image Using Outlook 1
J Object Variable or With Block Not Set Error in Outlook 2016 and not Outlook 2013 Outlook VBA and Custom Forms 3
Diane Poremsky Block Macros in Office 2013/2016 New Slipstick.com Articles 0
A Block user to send emails to specific set of email ids Using Outlook 1
O Block outlook appoinments Using Outlook 1
I How to block time in another calendar without invite? Using Outlook 2
H In Exchange 2010, how to block an email containing an attachment that has foreign characters Exchange Server Administration 1
Wotme VBA to block senders Outlook VBA and Custom Forms 1
A 5.7.1 Recipient not authorized, your IP has been found on a block list Using Outlook 1
S Block read receipt when outlook is configured to Exchange server Using Outlook 0
M Change font of from/to/subject block Using Outlook 1
O Block sender option disappeared? Using Outlook 3
L Block others from inserting appointments in your calendar Using Outlook 3
J Mail merge, labels, contact lists, address block Using Outlook 2
I 550 5.7.1 The IP address XXXXXXXXX was rejected by the Realtime Block List provider zen.spamhaus.org Using Outlook 1
H Use group policy to block access to modify account settings outlook/exchange 2010. Using Outlook 1
D Junk setting do not respond to "Never Block Sender Using Outlook 3
M block individual IP to Exchange 2010 owa Exchange Server Administration 3
W How do you block spam from your incoming mail on outlook? Using Outlook 2
A Block Audio and Video Exchange Server Administration 2
A Any way of logging IP Block Lists? Exchange Server Administration 3
M Is it unsafe to block Automatic DB Activation with only 2 DAG members and 1 FSW??? Exchange Server Administration 8
J Want to block access to Mail Format Tab in Outlook 2007 Using Outlook 1
V Re: JUNK MAIL FOLDER HAS A BLOCK THAT I DO NOT UNDERSTAND. IT JUST STARTED 2 DAYS AGO. Using Outlook 1
G Outlook Calendar block Using Outlook 2
D Signature setup doesn't work and file block settings isn't visible Using Outlook 1
L Junk filter will not block certain types of email addresses it has identified as junk. Using Outlook 2
L How to block meeting requests from automatically appearing on the calendar. Using Outlook 1
O Deleting block of re-occurring meetings in Outlook Using Outlook 1
D Block forwarding of meeting requests Using Outlook 2
T Exchange 2010 SP1 and Continuous Replication Block Mode (CRBM) Exchange Server Administration 1
J In Outlook 2010 selecting the Junk drop down for a message & then "Never block..." fails to add entr Using Outlook 7
W Block an email address to receive emaails from me Using Outlook 1
V Block Senders list not blocking senders Using Outlook 4
B Can't get Outlook '03 to block an address Using Outlook 1
R In my e-mails, I can not open hyperlinks. Tells me access is denied and the URL has a prefix "block Using Outlook 4
M block emails with specific subjects BCM (Business Contact Manager) 1
J Exchange 2010 Block Diagram Exchange Server Administration 2
X Highlight block of text in an outlook mail using c#2008 vsto Outlook VBA and Custom Forms 1
Q Otlk 2007 does not block when in "always prompt for..." mode Outlook VBA and Custom Forms 2
D Sending email from Office 365 alias in Outlook Using Outlook 4
E Change sending account depending on Subjectline Outlook VBA and Custom Forms 0
L unblocking attachments before sending Office 365 Advanced Protection Using Outlook 0
B Outlook 2003 email sending & receiving suddenly stopped working Using Outlook 3
R Warn before sending message Outlook VBA and Custom Forms 4
HarvMan Hotmail - Sending email is undeliverable Using Outlook 4
A Sending contact vcards sends older version instead of updated version Using Outlook 4
M McAllister Outlook stops Sending/Receiving/Synching after disconnecting remote desktop session Using Outlook 2
D Adding Enterprise Exchange Email Account to Outlook Prevents Sending via Outlook.com Account Using Outlook.com accounts in Outlook 10
Similar threads


















































Top