phpmailer hostinger

Solutions on MaxInterview for phpmailer hostinger by the best coders in the world

showing results for - "phpmailer hostinger"
Arianna
25 May 2017
1<?php
2use PHPMailer\PHPMailer\PHPMailer;
3require 'vendor/autoload.php';
4$mail = new PHPMailer;
5$mail->isSMTP();
6$mail->SMTPDebug = 2;
7$mail->Host = 'smtp.hostinger.com';
8$mail->Port = 587;
9$mail->SMTPAuth = true;
10$mail->Username = 'test@hostinger-tutorials.com';
11$mail->Password = 'YOUR PASSWORD HERE';
12$mail->setFrom('test@hostinger-tutorials.com', 'Your Name');
13$mail->addReplyTo('test@hostinger-tutorials.com', 'Your Name');
14$mail->addAddress('example@email.com', 'Receiver Name');
15$mail->Subject = 'Testing PHPMailer';
16$mail->msgHTML(file_get_contents('message.html'), __DIR__);
17$mail->Body = 'This is a plain text message body';
18//$mail->addAttachment('test.txt');
19if (!$mail->send()) {
20    echo 'Mailer Error: ' . $mail->ErrorInfo;
21} else {
22    echo 'The email message was sent.';
23}
24?>