Skip to content

Instantly share code, notes, and snippets.

View jeremyjenkins5's full-sized avatar

Jeremy Jenkins jeremyjenkins5

View GitHub Profile
@jeremyjenkins5
jeremyjenkins5 / SendMailgunEmail.ps1
Created August 9, 2016 20:22 — forked from ctigeek/SendMailgunEmail.ps1
Send an email using Mailgun in Powershell.
function Send-MailgunEmail($from, $to, $subject, $body, $emaildomain, $apikey) {
$idpass = "api:$($apikey)"
$basicauth = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($idpass))
$headers = @{
Authorization = "Basic $basicauth"
}
$url = "https://api.mailgun.net/v2/$($emaildomain)/messages"
$body = @{
from = $from;