Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Verify Send From address before sending mail in outlook

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

604 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