How to send emails from azure servers?

satya - 8/9/2016, 8:28:33 AM

How to send emails from azure servers?

How to send emails from azure servers?

Search for: How to send emails from azure servers?

satya - 8/9/2016, 8:28:44 AM

Say when a scheduled task fails...

Say when a scheduled task fails...

satya - 8/9/2016, 8:30:10 AM

How to Send Email Using SendGrid with Azure

How to Send Email Using SendGrid with Azure

satya - 8/9/2016, 8:31:52 AM

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

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?

satya - 8/9/2016, 8:34:59 AM

How to send emails from a windows command prompt?

How to send emails from a windows command prompt?

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

satya - 8/9/2016, 8:37:48 AM

This is some information about gmail and powershell

This is some information about gmail and powershell

satya - 8/9/2016, 8:40:14 AM

bmail blat

bmail blat

Search for: bmail blat

satya - 8/9/2016, 8:48:32 AM

How to send email from the command line with SendGrid

How to send email from the command line with SendGrid

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

satya - 8/9/2016, 8:55:30 AM

How do I invoke a powershell from windows command line?

How do I invoke a powershell from windows command line?

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

satya - 8/9/2016, 8:56:49 AM

How to use powershell to send emails from command line windows

How to use powershell to send emails from command line windows

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

satya - 8/9/2016, 9:01:03 AM

Here is a comprehensive set of 7 command line tools

Here is a comprehensive set of 7 command line tools

satya - 8/9/2016, 9:01:22 AM

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

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

satya - 8/9/2016, 9:03:46 AM

another example of powershell

another example of powershell

satya - 8/9/2016, 4:31:52 PM

Follow this to create a gmail account

Follow this to create a gmail account

satya - 8/9/2016, 4:32:30 PM

I decided to use powershell to send emails

I decided to use powershell to send emails

satya - 8/9/2016, 4:32:43 PM

Read here on powershell basics

Read here on powershell basics

satya - 8/9/2016, 4:34:36 PM

Here is some powershell code to do this


$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)

satya - 8/9/2016, 4:35:22 PM

Key things are

Port 587

EnableSSL to true

You have to set your gmail account to less secure option

satya - 8/9/2016, 4:40:36 PM

Assuming the above code is in a file with extension of .ps1 (that not letter but number ONE)


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.