Last active
August 29, 2017 21:54
-
-
Save cythrawll/8824ad47061e6e77a0887958f624f92e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once '../vendor/autoload.php'; | |
// Create the Transport | |
$transport = (new Swift_SmtpTransport('localhost', 1025)); | |
// Create the Mailer using your created Transport | |
$mailer = new Swift_Mailer($transport); | |
// Create a message | |
$message = (new Swift_Message('Wonderful Subject')) | |
->setFrom(['[email protected]' => 'John Doe']) | |
->setTo(['[email protected]', '[email protected]' => 'A name']) | |
->setBody('Here is the message itself'); | |
// Send the message | |
$result = $mailer->send($message); | |
if($result) { | |
echo '<h1>MESSAGE SENT</h1>'; | |
} else { | |
echo 'Email failed'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment