PHPMailer All Feature

In this article we have talk about why you should use PHPMailer instead of PHP mail() function and we have show some code samples on how to use this library.

PHPMailer is one of the most popular open source PHP libraries to send emails.

Although it was released in early 2000s, it is now a very commonly adopted approach among developers for sending emails in PHP.

You may also like How to send mail in PHP using PHPMailer and How to send attachment mail in PHP using PHPMailer.

Download PHPMailer Library.

PHP Code using PHPMailer with all Feature


$mail  = new PHPMailer(); 

$mail->Host = "";  /*SMTP server*/

$mail->SMTPAuth = true;

$mail->Port = '';
$mail->Username = "";  /*Username*/
$mail->Password = "";    /**Password**/

$address = "";

$mail->SetFrom('', 'demo');

$mail->AddAddress($address, "Demo");
$mail->Subject    = "PHPMailer Test sEND MAIL";
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!";
$body  = "Mail body in HTML";
	echo "Mailer Error: " . $mail->ErrorInfo;
	echo "Message sent!";

Leave a Reply

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