Need to add some text in subject while creating new mails - NEED VB CODINGS

Status
Not open for further replies.
Outlook version
Email Account
Exchange Server
Hi,

please help me for the below need ??

We are using Outlook 2003 and need to send 100 to 120 mails a day. some of it are send secured & others are unsecured. Please give me some VBA codes to add "secure" in my subject line except to some domains so that I can avoid a lot of errors.
 
Outlook version
Email Account
Exchange Server
Re: Need to add some text in subject while creating new mails - NEED VB CODING

HI,

Thanks for the quick reply. Yeah I just want to add a text to the subject lines & also want to avoid that for some domains.

Thanks in advance
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Re: Need to add some text in subject while creating new mails - NEED VB CODING

It's probably use an itemsend script - this is a simplistic version. If the domains that don't get the tag are few, you could use case statements and exit the sub if they are found.

Code:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) 
 
If InStr(LCase(Item.to), "domain.com") Then 
 
With Item
 .subject = "Secure " & .subject 
 
End With
 End If 
 
End Sub
 
Outlook version
Email Account
Exchange Server
Re: Need to add some text in subject while creating new mails - NEED VB CODING

Hi,

the said code is not working. I have written myself a coding with some help. which is woking with my mails.

Can you assist me to do some "If" "If Not" with current coding.

My Coding is

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

If (Left(Trim(Item.Subject), 11)) <> "RESTRICTED " Then
Item.Subject = "RESTRICTED " + Item.Subject
End If


End Sub
 
Status
Not open for further replies.
Top