so I have used the Advanced option from the http://php-login.net/ and this creates an advanced login PHP script on my site. Allowing visitors to signup, and create an account. The way it works is visitors fill out the sign up form, and a verification email is sent. This email is a simple text email, and is defined via PHP's define() method. The code for the define is;
define("EMAIL_VERIFICATION_CONTENT", "Please click on this link to activate your account:");
And here's the code that sends the email;
/*
* sends an email to the provided email address
* @return boolean gives back true if mail has been sent, gives back false if no mail could been sent
*/
public function sendVerificationEmail($user_id, $user_email, $user_activation_hash)
{
$mail = new PHPMailer;
// please look into the config/config.php for much more info on how to use this!
// use SMTP or use mail()
if (EMAIL_USE_SMTP) {
// Set mailer to use SMTP
$mail->IsSMTP();
//useful for debugging, shows full SMTP errors
//$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
// Enable SMTP authentication
$mail->SMTPAuth = EMAIL_SMTP_AUTH;
// Enable encryption, usually SSL/TLS
if (defined(EMAIL_SMTP_ENCRYPTION)) {
$mail->SMTPSecure = EMAIL_SMTP_ENCRYPTION;
}
// Specify host server
$mail->Host = EMAIL_SMTP_HOST;
$mail->Username = EMAIL_SMTP_USERNAME;
$mail->Password = EMAIL_SMTP_PASSWORD;
$mail->Port = EMAIL_SMTP_PORT;
} else {
$mail->IsMail();
}
$mail->From = EMAIL_VERIFICATION_FROM;
$mail->FromName = EMAIL_VERIFICATION_FROM_NAME;
$mail->AddAddress($user_email);
$mail->Subject = EMAIL_VERIFICATION_SUBJECT;
$link = EMAIL_VERIFICATION_URL.'?id='.urlencode($user_id).'&verification_code='.urlencode($user_activation_hash);
// the link to your register.php, please set this value in config/email_verification.php
$mail->Body = EMAIL_VERIFICATION_CONTENT.' '.$link;
if(!$mail->Send()) {
$this->errors[] = MESSAGE_VERIFICATION_MAIL_NOT_SENT . $mail->ErrorInfo;
return false;
} else {
return true;
}
}
Now, everything works as it should, however, I wish to send a HTML email, and not a simple text email.
How would I go about doing this, altering the code I already have?
` maybe ? – Maximus2012 Feb 17 '16 at 15:00