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.
<?php
require_once '../swiftmailer/vendor/autoload.php';

// Create the Transport
$transport = (new Swift_SmtpTransport('bravada.websitewelcome.com', 587, 'tls'))
 ->setUsername('etc@sartimsolutions.com')
 ->setPassword('sartimsolution');

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

// Create a message
$message = (new Swift_Message('Message Subject Twoclock'))
 ->setFrom(['ect@sartimsolutions.com' => 'John Doe'])
 ->setTo(['altafhpatel@gsl.com'])
 ->setBody('Here is the message itself');

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

Post a Comment

0 Comments