How to send out multi emails using mailgun API in PHP -
i have tried run following code sending multiple emails using mailgun api in php. no email sent using code. code :
require 'vendor/autoload.php'; use mailgun\mailgun; $mgclient = new mailgun("my-api-key"); $domain = "sandboxfa3e9009746840be831c6edc9e9f1ee9.mailgun.org"; $result = $mgclient->sendmessage("$domain", array('from' => 'mailgun sandbox - test <postmaster@sandboxfa3e9009746840be831c6edc9e9f1ee9.mailgun.org>', 'to' => 'email_1@gmail.com, email_2@gmail.com', 'subject' => 'mailgun bulk-msg test kb', 'text' => 'your mail not support html', 'html' => 'html-portion here...', 'recipient-variables' => '{"email_1@gmail.com": {"first":"name-1", "id":1}, "email_2@gmail.com": {"first":"name-2", "id": 2}}') ); var_dump($result); ?> #=============================================== have mistake in code send multi email ? if have solution, please help.
i found api. (not answer maybe. reference)
require 'vendor/autoload.php'; use mailgun\mailgun; $mg = mailgun::create('key-example'); # $mg->messages()->send($domain, $params); $mg->messages()->send('example.com', [ 'from' => 'bob@example.com', 'to' => 'sally@example.com', 'subject' => 'the php sdk awesome!', 'text' => 'it simple send message.' ]);
Comments
Post a Comment