error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once '../vendor/autoload.php';
use Postmark\PostmarkClient;
use Postmark\Models\PostmarkException;
function sendForm($client, $to, $from, $subject, $html) {
$fromEmail = $from;
$toEmail = $to;
$subject = $subject;
$textBody = $subject;
$tag = "test-aston";
$trackOpens = true;
$replyTo = $to;
$trackLinks = "None";
$messageStream = "outbound";
$htmlBody = $html;
try {
$sendResult = $client->sendEmail(
$fromEmail,
$toEmail,
$subject,
$htmlBody,
$textBody,
$tag,
$trackOpens,
$replyTo,
NULL,
NULL,
NULL,
NULL,
$trackLinks,
NULL,
$messageStream
);
if( !empty($sendResult->MessageID)) {
return "1";
}
else {
return $sendResult;
}
}
catch(PostmarkException $ex){
return $ex;
}
}
$client= new PostmarkClient("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
$to = "merlin@monsite.be";
$from = "NoReply@monsite.be";
$subject = "Nouveau message";
$html = "
ceci est un autre test
Hello.
";
sendForm($client, $to, $from, $subject, $html);