Last active
April 2, 2020 07:00
-
-
Save darkcolonist/51a894470d96af20f11a49865428f293 to your computer and use it in GitHub Desktop.
sparkpost email template (using Swiftmailer 6.2.1)
This file contains hidden or 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 | |
ini_set('display_errors', 1); | |
ini_set('display_startup_errors', 1); | |
require_once('./vendor/autoload.php'); | |
$sparkpost_key = 'your+key+here'; // your password go here | |
$recipient = '[email protected]'; // enter your email here to receive the email | |
$sender = '[email protected]'; // enter your registered domain here at sparkpost | |
$transport = (new Swift_SmtpTransport('smtp.sparkpostmail.com', 2525)) | |
->setUsername('SMTP_Injection') | |
->setPassword($sparkpost_key) | |
->setEncryption('tls'); | |
$mailer = new Swift_Mailer($transport); | |
$message = new Swift_Message(); | |
$mail_subject = 'Production for '.date('Y-m-d'); | |
$message->setSubject($mail_subject); | |
$message->setFrom($sender); | |
$message->addTo($recipient, 'ultima'); | |
$mail_message = 'Production for '.date('Y-m-d'); | |
$message->setBody($mail_message); | |
$result = $mailer->send($message); | |
die(var_dump($result)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment