Celui-ci est un exemple rapide sur comment utiliser nos serveurs pour envoyer des messages transactionnels:
<? require_once("lib/swift_required.php"); $transport = Swift_SmtpTransport::newInstance("HOST.nzmail.eu", 465, "ssl"); $transport->setUsername("USER"); $transport->setPassword("PASS"); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance() ->setSubject("test") ->setFrom(array("youremail@example.com" => "Test")) ->setBody("Ola this is a test !") ->addPart("<b>Ola this is a HTML test !</b>", "text/html") ->setTo(array("recipient@example.com" => "Catalin Constantin")); $mailer->send($message); ?> |
Cet exemple utilise PHP et la librairie Swiftmailer.