PHP phpMailer

Issue

Not sure with settings of  PHP phpMailer

Symptoms

None

Cause

Lack of knowledge with the PHP phpMailer

Workaround

STEP 1: Obtain the PHPMailer from http://www.netonboard.com/download/phpMailer.zip

STEP 2: There are two files in the zip file (class.phpmailer.php and class.smtp.php).

STEP 3: Both files must be placed together.

STEP 4: Extract the files in a folder call phpmailer.

STEP 5: Open notepad and paste the following code to a PHP file after performing the necessary changes.

SMTPServer – The smtp server address (e.g: mail.yourdomainname)
EmailID – One of your Email Login ID
EmailPassword – Password for the selected Email
SenderEmail – Sender Email Address, only from your domain email
SenderName – Sender Email Name
RecipientEmail – Recipient Sender Email Name
RecipientName – Name
ReplyEmail – Sender Email Address, only from your domain email
ReplyName – Sender Email Name
Subject – Subject of the Email
MessageBody – Email Message Contents
PlainTextBody – Plain Text Message Contents, will display when recipient can’t read HTML

<?php
require(“./phpmailer/class.phpmailer.php”);

$mail = new PHPMailer();

$mail->IsSMTP();
$mail->Host = “SMTPServer“;
$mail->SMTPAuth = true;
$mail->Username = “EmailID“;
$mail->Password = “EmailPassword“;

$mail->From = “SenderEmail“;
$mail->FromName = “SenderName“;
$mail->AddAddress(“RecipientEmail“, “RecipientName“);
$mail->AddReplyTo(“ReplyEmail“, “ReplyName“);

$mail->IsHTML(true);

$mail->Subject = “Subject“;
$mail->Body    = “MessageBody“;
$mail->AltBody = “PlainTextBody”;

if(!$mail->Send())
{
echo “Message could not be sent. <p>”;
echo “Mailer Error: ” . $mail->ErrorInfo;
exit;
}

echo “Message has been sent”;
?>

Additional Information

PHPMailer does email transport class featuring file attachments, SMTP servers, CCs, BCCs, HTML messages, word wrap, and more. PHPMailer sends email via sendmail, PHP mail(), QMail, or with SMTP.

You may obtain the sample code that utilizes the phpmailer at http://www.netonboard.com/download/samplephpmailerform.zip

If you are unable to resolve the problem above, kindly issue a ticket to Support Team. 

Updated on March 14, 2019

Was this article helpful?

Related Articles

Leave a Comment