Send mail to outlook even when the smtp server/port is blocked

This is probably the simplest thing that an automation engineer can do:



Automate using vb-script sending an email to outlook:
The best way would be to create a CDO.message object like this :

Set MyEmail=CreateObject("CDO.Message")

MyEmail.Subject="Subject"
MyEmail.From="name@domain.com"
MyEmail.To="a@a.com"
MyEmail.TextBody="Testing one two three."

MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2

'SMTP Server
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.server.com"

'SMTP Port
MyEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 

MyEmail.Configuration.Fields.Update
MyEmail.Send

set MyEmail=nothing
 
But if you have restrictions in your org do this:

Function FnSendMail(intVal)
                Set MyApp = CreateObject("Outlook.Application")
                Set MyItem = MyApp.CreateItem(0)
                With MyItem
                          .To = "aditya.kalra@xyz.com;more@xyz.com"
                          .Subject = "Alert - Automated Email"
                          .ReadReceiptRequested = False
                          .HTMLBody = "
Automated Report

Alert: You have received this:  "&intVal&"%
"
                        End With
                MyItem.Send

End Function

Comments

Popular posts from this blog

Software Testing @ Microsoft

Trim / Remove spaces in Xpath?