SMTP Email using SWIFTMAILER - Hostgator

How to send email using SWIFTMAILER by using Hostgator. Use Swift Mailer instead of phpMailer without any hesitation working perfectly 2018.
require_once '../swiftmailer/vendor/autoload.php';

// Create the Transport
$transport = (new Swift_SmtpTransport('', 587, 'tls'))

// Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);

// Create a message
$message = (new Swift_Message('Message Subject Twoclock'))
 ->setFrom(['' => 'John Doe'])
 ->setBody('Here is the message itself');

// Send the message
$result = $mailer->send($message);

Post a Comment