Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- # Include the Autoloader (see "Libraries" for install instructions)
- require 'vendor/autoload.php';
- use Mailgun\Mailgun;
- # Instantiate the client.
- $mgClient = new Mailgun('key-5de7dbedc4569f05a359318ae2b38bc6');
- $domain = "sandbox91af2a08b4794186860486d1deeffbb2.mailgun.org";
- # Make the call to the client.
- $result = $mgClient->sendMessage($domain, array(
- 'from' => 'Naresh Testing <postmaster@sandbox91af2a08b4794186860486d1deeffbb2.mailgun.org>',
- 'to' => 'bhupinder@staplelogic.in, naresh@staplelogic.in, bhupinder.bisht22@gmail.com, bhupinder.staplelogic@gmail.com, bhupinder.bisht87@gmail.com',
- 'subject' => 'Hey %recipient.first%',
- 'h:Reply-To' => "bhupinder@staplelogic.in, naresh@staplelogic.in, bhupinder.bisht22@gmail.com, bhupinder.staplelogic@gmail.com, bhupinder.bisht87@gmail.com" ,
- 'html' => '<p>Welcome to Batching R&D on 14 April!.<a href="http://www.myconversionbrain.com">myconversionbrain.com</a> </p>',
- 'recipient-variables' => '{"bhupinder@staplelogic.in": {"first":"Bhupinder", "id":1},
- "naresh@staplelogic.in": {"first":"naresh", "id": 2},
- "bhupinder.bisht22@gmail.com": {"first":"bhgmail", "id": 3},
- "bhupinder.staplelogic@gmail.com": {"first":"bhupinstaplelogic", "id": 4},
- "bhupinder.bisht87@gmail.com": {"first":"bhupin87", "id": 5}
- }',
- ));
- echo "<pre>";
- print_r($result);
- echo "</pre>";
- if(!$result) {
- echo 'Message could not be sent.';
- // echo 'Mailer Error: ' . $mail->ErrorInfo;
- } else {
- echo 'Message has been sent';
- }
- ?>
Add Comment
Please, Sign In to add comment