MsgBox when not sending from specified account

Status
Not open for further replies.

Mister-B

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Exchange Server
Hi there,

in my company we have Outlook 2016 on an Exchange server. I have several accounts that I see when I open Outlook. The problem I have is that I often forget to set the "From" tab when I am writing Mails. This means that I very often send them from my own account, which is the default, instead of from the account that I should be using. Is it possible for VBA code to send out a Message if a particular account is not selected in "From"? This code should be activated when I hit the "Send" button.

Regards,
Martin
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I have this macro - Warn Before Sending Messages to the Wrong Email Address

I use a version of it myself - i only check messages sent to one specific domain that has restrictions on the addresses that can send to it. Since only one of my accounts is allowed, I stop the send if the wrong account is sending.
 

Mister-B

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Exchange Server
Hi Diane,

thanks for pointing me in the right direction. Funnily "Item.SendUsingAccount" didn't work for me. I got around it by using the "Item.SendOfBehalfname". This is my Code and it works fine:

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If Item.SentOnBehalfOfName = "Fortbildung (xxxxxxx)" Then Exit Sub
If MsgBox("Have you selected the correct account?", vbYesNo, "My Company") <> vbYes Then
Cancel = True
End If
End Sub

Kind regards,
Martin
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
C MsgBox Everytime I send a mail Using Outlook 1
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
B When sending an email, I am showing 2 of my address's Using Outlook 1
M Auto expand Distribution List Before Sending Email Outlook VBA and Custom Forms 1
A Check for words in subject header before sending email Outlook VBA and Custom Forms 4
O Run macro automatically at sending an email Using Outlook 11
W Sending To Wrong Account Using Outlook 15
H Select Specific Account When Sending Email, Based on Current Folder Outlook VBA and Custom Forms 1
M Help sending email but removing signature via VBA Outlook VBA and Custom Forms 5
A Script to fetch data from mails in restricted collection and sending them to excel Using Outlook 1
R Sending emails via Outlook XP, from Windows 10 File Explorer Using Outlook 1
L Creating drafts when I thought I was sending Using Outlook 1
C address book "when sending email" bug? Using Outlook 0
H Custom autoforwarding, sending mail through outlook office 365 Using Outlook 1
R Sending email copy (*.msg file) of sent email if subject line contains specific string. Outlook VBA and Custom Forms 1
C replace subject line generated by converting a word document to PDF and sending it to an email Using Outlook 8
A Sending Emails Through Outlook From Multiple Email Addresses Using Outlook 1
P Outlook 365 sending intermittently Using Outlook 0
C How to avoid sending mail to the wrong contact person New Slipstick.com Articles 1
V iCloud Calendar invitations not sending Using Outlook 3
O Rules and Alerts for New Messages BEFORE sending Using Outlook 2
latitudeit Outlook for Android - Sending from an alias address Using Outlook 2
X Delay sending an email until the next working day (public holidays) Outlook VBA and Custom Forms 0
D Macro sending outlook template from Excel list Outlook VBA and Custom Forms 6
A How to get rid of "sending on behalf of" when sending from Outlook 2016 client Using Outlook 12
O Outlook 2013 Problems sending large mails Using Outlook 4
Diane Poremsky Automatically create a task when sending a message New Slipstick.com Articles 0
P Categorise emails on sending - macro not working in Preview mode Using Outlook 1
Diane Poremsky Outlook is sending winmail.dat attachments New Slipstick.com Articles 0
Diane Poremsky Select from a List of Subjects before Sending a Message New Slipstick.com Articles 0
P Outlook 2010 sending safe senders email to junk box Using Outlook 8
Diane Poremsky To delay sending a message in Outlook New Slipstick.com Articles 0
F Avoid sending duplicate using Outlook script Outlook VBA and Custom Forms 2
D Close Oulook after sending emails via vba without outbox getting stuck. Outlook VBA and Custom Forms 1
M godaddy says my outlook's sending spam. Using Outlook 4
Diane Poremsky Check for missing attachments before sending a message New Slipstick.com Articles 1
Diane Poremsky Warn before sending messages to the wrong email address New Slipstick.com Articles 1
J Add-in for sending mass emails Using Outlook 14
Dilshad VBA editor opens when sending an email Using Outlook 2
Diane Poremsky Sending Email from a Secondary Exchange Mailbox New Slipstick.com Articles 0
P Outlook 2007 not sending/receiving until restart (send/receive stuck at __%) Using Outlook 27
J Force account selection for sending reply emails Using Outlook 1
Diane Poremsky Add Attachment Names to Message Before Sending New Slipstick.com Articles 0
Similar threads


















































Top