How to send emails from azure servers?

How to send emails from azure servers?

Search for: How to send emails from azure servers?

Say when a scheduled task fails...

How to Send Email Using SendGrid with Azure

How to send an email from command line on microsoft azure or windows?

Search for: How to send an email from command line on microsoft azure or windows?

How to send emails from a windows command prompt?

Search for: How to send emails from a windows command prompt?

This is some information about gmail and powershell

bmail blat

Search for: bmail blat

How to send email from the command line with SendGrid

Search for: How to send email from the command line with SendGrid

How do I invoke a powershell from windows command line?

Search for: How do I invoke a powershell from windows command line?

How to use powershell to send emails from command line windows

Search for: How to use powershell to send emails from command line windows

Here is a comprehensive set of 7 command line tools

Apparently to use gmail smtp server the client has to support SSL

another example of powershell

Follow this to create a gmail account

I decided to use powershell to send emails

Read here on powershell basics


$user = "username"
$pass = "password"
$SmtpServer = "smtp.gmail.com"

$SmtpClient = New-Object System.Net.Mail.SmtpClient
$SmtpClient.host = $SmtpServer 
$smtpClient.Port=587
$SmtpClient.EnableSsl=$true
$SmtpClient.Credentials=New-Object System.Net.NetworkCredential($user, $pass)

$From = "from-address"
$To = "to-address"
$Title = "Test mail"
$Body = "Body Text" 
$SmtpClient.Send($From,$To,$Title,$Body)

Port 587

EnableSSL to true

You have to set your gmail account to less secure option


powershell -executionpolicy remotesigned -file sendmail.ps1

See the notes on powershell using the powershell link above to understand this syntax.

This will allow me to execute this in a command file when a scheduled task fails for whatever reason.