Skip to content

Instantly share code, notes, and snippets.

@jekayode
Last active July 14, 2020 10:39
Show Gist options
  • Select an option

  • Save jekayode/44a00f2cfcc8e8dc0c2fbb12e21f506e to your computer and use it in GitHub Desktop.

Select an option

Save jekayode/44a00f2cfcc8e8dc0c2fbb12e21f506e to your computer and use it in GitHub Desktop.
<?php
require 'vendor/autoload.php';
use Mailgun\Mailgun;
// First, instantiate the SDK with your API credentials
$mg = Mailgun::create('my-domain-apikey'); // For US servers
//$mg = Mailgun::create(‘my-apikey, 'https://api.eu.mailgun.net'); // For EU servers
$name = "Emmanuel";
$email = "emmanuel@email.com";
$message = "Thank you for a job well done";
$reslt = $mg->messages()->send('my-mailgun-domain', [
'from'=> $email,
'to'=> 'support@company.com',
'subject' => 'Testimonial Email,
'html' => $message,
]);
//var_dump($result);
$response = $result->getMessage(); // Grab success message
echo $response;
?>
Note: Remember to first run `require mailgun/mailgun-php` in your project root
@jekayode
Copy link
Author

Initial commit

@jekayode
Copy link
Author

Added composer command instruction

@jekayode
Copy link
Author

Typo correction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment