Last active
August 20, 2018 16:54
-
-
Save pontikis/5a6e57be756e1c3ed387400f912c8a7b to your computer and use it in GitHub Desktop.
Send mail with PHP Mailgun API
This file contains hidden or 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
<?php | |
$mg = Mailgun::create('YOUR_PRIVATE_API_KEY'); | |
$mg_domain = 'mail.company.com'; | |
$mg_response = $mg->messages()->send($mg_domain, | |
[ | |
'subject' => 'Subject here', | |
'from' => 'Company Support <[email protected]>', | |
'to' => 'John Doe <[email protected]>', | |
'h:Reply-To' => 'Do NOT reply <[email protected]>', | |
'text' => 'plain text message', | |
'html' => '<html><body>html message</body</html>', | |
'inline' => [ | |
[ | |
'filePath' => '/path/to/logo-640x350.jpg', | |
'filename' => 'logo.jpg', | |
], | |
[ | |
'filePath' => '/path/to/facebook-32x32.png', | |
'filename' => 'facebook.png', | |
], | |
], | |
'attachment' => [ | |
[ | |
'filePath' => '/path/to/inv_314567.pdf', | |
'filename' => 'invoice.pdf', | |
], | |
], | |
] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment