Solved

Verify Send From address before sending mail in outlook

Posted on 2013-02-04
3
423 Views
Last Modified: 2013-02-06
Hi,

I'm new to VBA in Outlook, but have created this little script that pops up a confirmation box that asks if the user have remembered to choose the right "Send from" address.

However I'd like to have it do that - only - if a particular send from address has been selected - how can I do that?

Here's the script so far:

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

    Dim intRes As Integer
    Dim strMsg As String
    strMsg = "Har du husket den rigtige ""From"" adresse? "
    intRes = MsgBox(strMsg, vbYesNo + vbDefaultButton1, "HUSK! ")
    If intRes = vbNo Then
    Cancel = True
    End If

End Sub
0
Comment
Question by:imfpalne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 28

Accepted Solution

by:
omgang earned 500 total points
ID: 38851635
Try this.
OM Gang

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

    Dim intRes As Integer
    Dim strMsg As String, strSender As String

    strSender = Item.SendUsingAccount.SmtpAddress
        'test from address
    If strSender = "theparticularaddress@mydomain.com" Then

        strMsg = "Har du husket den rigtige ""From"" adresse? "
        intRes = MsgBox(strMsg, vbYesNo + vbDefaultButton1, "HUSK! ")
        If intRes = vbNo Then
            Cancel = True
        End If
    End If

End Sub
0
 

Author Closing Comment

by:imfpalne
ID: 38858633
That did the trick! Thanks!
0
 

Author Comment

by:imfpalne
ID: 38858826
Hi OM gang,

You'r solution worked for my account, but apparently not for my colleague - I've created a new question here if you could take a look at it?

http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_28021804.html
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question