SMTP Email using SWIFTMAILER – Hostgator

How to send email using swiftmailer with hostgator alternative to phpmailer which is not working fine. Use swiftmailer instead of phpMailer.

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);

Leave a Reply

Your email address will not be published. Required fields are marked *