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.

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

Leave a Reply

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

Offline

Offline
Offline