Answers for "phpmailer hostinger"

PHP
1

phpmailer hostinger

<?php
use PHPMailer\PHPMailer\PHPMailer;
require 'vendor/autoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Host = 'smtp.hostinger.com';
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'YOUR PASSWORD HERE';
$mail->setFrom('[email protected]', 'Your Name');
$mail->addReplyTo('[email protected]', 'Your Name');
$mail->addAddress('[email protected]', 'Receiver Name');
$mail->Subject = 'Testing PHPMailer';
$mail->msgHTML(file_get_contents('message.html'), __DIR__);
$mail->Body = 'This is a plain text message body';
//$mail->addAttachment('test.txt');
if (!$mail->send()) {
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'The email message was sent.';
}
?>
Posted by: Guest on May-14-2020

Browse Popular Code Answers by Language