+ Reply to Thread
Results 1 to 2 of 2

block user to send mail to public domain

Hybrid View

  1. #1
    Registered User
    Join Date
    04-26-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    21

    block user to send mail to public domain

    hii,

    Greetings,

    my team using outlook 2010 for communication. few days back I came to know one of them has sent confidential files to there personal mail id(public domain) by mistake.
    could you please help me to get macro to block specific users to send mail to public domain.
    like when they send mail to public domain (@publicdomain.com) they get msg box unable send to public domain.

  2. #2
    Forum Contributor
    Join Date
    08-27-2006
    Posts
    136

    Re: block user to send mail to public domain

    From http://www.slipstick.com/how-to-outl...email-address/

    "This macro checks messages for one specific address and if it finds the address, allows you to cancel the send. On Error Resume Next allows it to work with meetings or task requests, otherwise it kicks up an error message."

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
         
    On Error Resume Next
     ' use lower case for the address
     ' LCase converts all addresses in the To field to lower case
    If InStr(LCase(Item.To), "[email protected]") Then
          Prompt$ = "You sending this to " & Item.To & ". Are you sure you want to send it?"
           If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check Address") = vbNo Then
             Cancel = True
           End If
      End If
         
    End Sub
    To make this work for you "[email protected]" becomes "@publicdomain.com"

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
         
    On Error Resume Next
     ' use lower case for the address
     ' LCase converts all addresses in the To field to lower case
    
    If InStr(LCase(Item.To), "@publicdomain.com") Then
        Prompt$ = "Sending to @publicdomain.com will be cancelled."
        MsgBox Prompt$
        Cancel = True
    End If
    
    End Sub
    This macro needs to be added to ThisOutlookSession to work.
    To mark "Solved" go to Thread Tools.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 03-11-2014, 12:24 PM
  2. How to e-mail selected row and use e-mail address in a cell to send e-mail from excel
    By syedalamgir in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2010, 02:15 AM
  3. Calling a DLL from Excel.:public domain
    By Jim15 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-02-2007, 02:40 PM
  4. User form and send mail
    By wizard5353 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-27-2005, 11:05 AM
  5. Is there an excel, public domain, rough cut capacity template?
    By edish in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-27-2005, 09:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1