?
Solved

Verify Send From address before sending mail in outlook

Posted on 2013-02-04
3
Medium Priority
?
425 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 1500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

764 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