Created
December 2, 2015 20:30
-
-
Save pkskelly/0b16f9892234e88c50c3 to your computer and use it in GitHub Desktop.
Sending Email from PowerShell using SendGrid (in Azure)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Username ="azure_*********@azure.com" | |
$Password = ConvertTo-SecureString "********" -AsPlainText -Force | |
$credential = New-Object System.Management.Automation.PSCredential $Username, $Password | |
$SMTPServer = "smtp.sendgrid.net" | |
$EmailFrom = "[email protected]" | |
$EmailTo = "[email protected]" | |
$Subject = "SendGrid test" | |
$Body = "SendGrid testing successful" | |
Send-MailMessage -smtpServer $SMTPServer -Credential $credential -Usessl -Port 587 -from $EmailFrom -to $EmailTo -subject $Subject -Body $Body |
Thanks. Nice Script. Works perfect. Only one thing 1 had changed.
$Username ="azure_*********@azure.com"
should be
$Username ="apikey"
Username is always apikey
The password defines the configuration in Sendgrid
Thanks !!
…On Wed, Jul 24, 2024 at 6:54 PM Johan Parlevliet ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Thanks. Nice Script. Works perfect. Only one thing 1 had changed.
$Username ***@***.***"
should be
$Username ="apikey"
Username is always apikey
The password defines the configuration in Sendgrid
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/pkskelly/0b16f9892234e88c50c3#gistcomment-5131760>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADRGQ6HSRRW2CJOGY3YFGIDZN6TIBBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVAZDQNJWG42TGNFHORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you commented on the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
--
*Regards,*
*Niral.*
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The operation has timed out.