quick-phpmailer-wrapper/index.php
2019-09-15 18:08:44 +01:00

41 lines
899 B
PHP

<?php
require 'vendor/autoload.php';
// for testing use only. Please define user, password and host in a config file of your own
$mail = new MailWrapper();
$mail
->setHost("smtp.spacejewel-hosting.com") // can be anything that has a mail server
->setProtocol("tls") // auto sets the port
->setAuthPassword("examplepassword")
->setFullyQualifiedAddress("exampleuser")
->setRecipient("johndoe@example.com")
->setReplyto("someone@example.com")
->setFrom("someone@example.com")
->prepare();
$content = <<<EOL
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<p>Hello,</p>
<p>This is a sample test message</p>
</body>
</html>
EOL;
try
{
$mail->send("Test message", $content);
}
catch (Exception $ex)
{
echo "Problem while sending mail! " . $ex->getMessage();
}