Welcome Guest ( Log In | Register )

Outline · [ Standard ] · Linear+

 summernote + PHP Mailer, Email not in HTML form

views
     
TSmeiyi
post Jun 18 2015, 08:25 PM, updated 9y ago

Regular
******
Senior Member
1,403 posts

Joined: May 2013


I tried using summernote

and PHP Mailer to sent the contents to my e-mail.

But the e-mail does not appear to be in HTML form eventhough I put :

CODE
$mail->IsHTML(true); //set email format to HTML


Below is my code for sending e-mail:

CODE
require '../PHPMailerAutoload.php';

$mail = new PHPMailer();

$mail->IsSMTP(); //set mailer to use SMTP
$mail->Host = "mail.xxxyy.com"; //specify SMTP mail server
$mail->Port = "2525"; //specify SMTP Port
$mail->SMTPAuth = true; //turn on SMTP authentication
$mail->Username = "xxxxx@xxxxx.com"; //Full SMTP username
$mail->Password = "xxxxx"; //SMTP password

$mail->From = "xxxxx@xxx.com";
$mail->FromName = "xxxxx";
$mail->AddAddress("xxxxxx", "Mei Yi");

$mail->WordWrap = 50; //optional, you can delete this line
$mail->IsHTML(true); //set email format to HTML

$mail->Subject = "RE:". $_POST[txtFeedbackSubject2];

$mail->Body = htmlspecialchars($_POST['content']);

if(!$mail->Send())
{
echo "Message could not be sent.

";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}

echo "Message has been sent";


The e-mail content appears to be like this:

CODE

<span style=\"font-weight: bold; font-style: italic; text-decoration: underline;\">Aadadssdasadsad.</span>


How do I ensure that my e-mail recieve the sentences from summernote text area as bolded?

Please advice.

Thanks.
str4n93r
post Jun 19 2015, 11:13 PM

Getting Started
**
Junior Member
94 posts

Joined: Jul 2012
From: Batcave



you can try using this template. responsive summore

http://zurb.com/ink/
ngbh
post Jul 3 2015, 08:28 PM

On my way
****
Senior Member
534 posts

Joined: Jan 2003
From: KL



u use local host or web server/ mail server ?
Fork
post Jul 11 2015, 10:27 PM

Getting Started
**
Junior Member
150 posts

Joined: Sep 2010
QUOTE(meiyi @ Jun 18 2015, 08:25 PM)
I tried using summernote

and PHP Mailer to sent the contents to my e-mail.

But the e-mail does not appear to be in HTML form eventhough I put :

CODE
$mail->IsHTML(true); //set email format to HTML


Below is my code for sending e-mail:

CODE
require '../PHPMailerAutoload.php';

$mail = new PHPMailer();

$mail->IsSMTP(); //set mailer to use SMTP
$mail->Host = "mail.xxxyy.com"; //specify SMTP mail server
$mail->Port = "2525"; //specify SMTP Port
$mail->SMTPAuth = true; //turn on SMTP authentication
$mail->Username = "xxxxx@xxxxx.com"; //Full SMTP username
$mail->Password = "xxxxx"; //SMTP password

$mail->From = "xxxxx@xxx.com";
$mail->FromName = "xxxxx";
$mail->AddAddress("xxxxxx", "Mei Yi");

$mail->WordWrap = 50; //optional, you can delete this line
$mail->IsHTML(true); //set email format to HTML

$mail->Subject = "RE:". $_POST[txtFeedbackSubject2];

$mail->Body = htmlspecialchars($_POST['content']);

if(!$mail->Send())
{
echo "Message could not be sent.

";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}

echo "Message has been sent";


The e-mail content appears to be like this:

CODE

<span style=\"font-weight: bold; font-style: italic; text-decoration: underline;\">Aadadssdasadsad.</span>


How do I ensure that my e-mail recieve the sentences from summernote text area as bolded?

Please advice.

Thanks.
*
Ur message is encoded with htmlspecialchar, U don't need to encode it.

ur mail server will automatically strip the unneccessary tags when U receive ur email.

There is no way U can fully sanitize and error free when U allow html input, so U can parse as is first.

 

Change to:
| Lo-Fi Version
0.0135sec    0.13    5 queries    GZIP Disabled
Time is now: 29th March 2024 - 06:16 AM