Jump to content

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


joseph

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);

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.