Jump to content

How to decode the <br /> tags I receive in my email?


Recommended Posts

I have search about htmlspecialchars_decode:

http://www.phpfreaks.com/phpmanual/page/function.htmlspecialchars-decode.html

 

But not sure how to implement them on sendmail functions.

 

	$subject = $params['subject'];
	$body = $params['body'];

	$replacements = array();
	$replacements['{sitename}'] = $mosConfig_sitename;
	$replacements['{name}'] = $invitor;
	foreach ( $replacements as $search => $replace ) {
		$subject = str_replace( $search, $replace, $subject );
		$body = str_replace( $search, $replace, $body );
	}		

	$mail = mosCreateMail( $mosConfig_mailfrom, $mosConfig_fromname, $subject, $body );
	$mail->AddAddress( $this->invitee_email );
	$mail->IsHTML( false );
	       

	if ( !$mail->Send() ) {
		$this->_error = 'mosMail error!';
		return false;
	}

 

The mails I received are having <br /> tags but html are actually being decoded. What I want is to decode those <br /> tags and make them disappear but maintains having the line space when I received my mails.

 

I'm thinking that I might need the strip tags php function? But how do I implement them on this $mail?

 

Thanks.

If you are sending html code in your email you will need to send the html header with your email. But looking at your code it looks like you need to change this line:

$mail->IsHTML( false );

to this:

$mail->IsHTML( true);

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.