<?php
require_once("Newsman/Client.php");
// you can get your API KEY, your newsman_user_id and list_id from My account -> API
$newsman_user_id = "your-user-id";
$api_key = "your-api-key";
$list_id = "your-list-id";
$mime_message = "Date: Thu, 13 Sep 2018 10:39:49 +0300\r\nFrom: Acme Company <acme@example.com>\r\nReply-To: Acme Company <acme@example.com>\r\nOrganization: Acme Company\r\nMessage-ID: <1547610873.20180913103949@example.com>\r\nTo: recipient@example.com\r\nSubject: hi there - test message\r\nMIME-Version: 1.0\r\nContent-Type: multipart\/alternative;\r\n boundary=\"----------0BD00325510B473B0\"\r\n\r\n------------0BD00325510B473B0\r\nContent-Type: text\/plain; charset=iso-8859-15\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\nThis is an amazing test.\r\n\r\n--=20\r\nAcme Company\r\nhttps:\/\/www.example.com\r\n------------0BD00325510B473B0\r\nContent-Type: text\/html; charset=iso-8859-15\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n<html><head><title>hi there - test message<\/title>\r\n<\/head>\r\n<body>\r\n<span style=3D\" font-family:'courier new'; font-size: 9pt;\"><b>This<\/b>&nbs=\r\np;is an amazing test.<br>\r\n<br>\r\n<span style=3D\" font-family:'arial'; color: #c0c0c0;\"><i>--<br>\r\nAcme Company\r\n<\/i><\/span><\/span><a style=3D\" font-family:'arial'; font-size: 9pt;\" href=\r\n=3D\"http:\/\/www.newsman.ro\">https:\/\/www.example.com<\/a><br>\r\n<a style=3D\" font-family:'arial'; font-size: 9pt;\" href=3D\"http:\/\/www.examp=\r\nle.com\">https:\/\/www.example.com<\/a><\/body><\/html>\r\n------------0BD00325510B473B0--";
$recipients = array(
array( "email" => "recipient-1@company.com", "name" => "Recipient 1", "params" => array("name" => "Johnny") ),
array( "email" => "recipient-2@company.com", "name" => "Recipient 2", "params" => array("name" => "Mark") )
);
try {
$client = new Newsman_Client($newsman_user_id, $api_key);
$ret = $client->transactional->messageSendRaw($list_id, $mime_message, $recipients);
} catch (Exception $e) {
//do something with the error, eg: log $e->getMessage()
}
return $ret;
?>