Links not working when sent from phpmailer

First off I want to see I am not a php programmer and I had someone else actually do this script for me.
What I am trying to do is send an html email using a form and phpmailer. (php version 5.2.17) I am putting html into a text box and sending it as an email. When the person receives the email the formatting and everything is fine. But none of the links in the emails work. When I view the source of the email there are to back slashes added () to the links.
So this:

<A HREF="http://www.hotmail.com">http://www.hotmail.com</a>

becomes this:

 <A HREF=\"http://www.hotmail.com\">http://www.hotmail.com</a>

And the links no longer work.

I am including the link for the html form and the php code below.

The form code:

[code]

Form
  	<td valign="top" colspan="2"><p>Your message (required)</p> <textarea name="maildsc" required="required" cols="60" rows="10" >
			<?php
			</textarea> </td>
  </tr>
	<tr>
  	<td valign="top" colspan="2"><input type="submit" value="Submit" /></td>
  </tr>
</table>
[/code]

The php code:
[php]<?php
//configs
$Host = “mailserverhostname”;
$Port = 2525;
$Username = $_POST[‘mailfrom’];
$Password = “thepassword”;

// processing start
if(isset($_POST['nmto'])){
	
$fromName 					=	$_POST['nmfrom'];
$toName 						=	$_POST['nmto'];
$mailAddressfrom 		=	$_POST['mailfrom'];
$mailAddressto 			=	$_POST['mailto'];
$subj 							=	$_POST['mailsubj'];
$description 				=	$_POST['maildsc'];

require_once(‘PHPMailer/class.phpmailer.php’);
//include(“class.smtp.php”); // optional, gets called from within class.phpmailer.php if not already loaded

$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

$mail->IsSMTP(); // telling the class to use SMTP

try {
// $mail->Host = “mail.simvolleyball.com”; // SMTP server
// $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = $Host; // sets the SMTP server
$mail->Port = $Port; // set the SMTP port for the GMAIL server
$mail->Username = $Username; // SMTP account username
$mail->Password = $Password; // SMTP account password
$mail->AddAddress($mailAddressto, $toName);
$mail->SetFrom($mailAddressfrom, $fromName);
$mail->AddReplyTo($mailAddressfrom, $fromName);
$mail->Subject = $subj;
$mail->AltBody = $description; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML($description);
// $mail->AddAttachment(‘images/phpmailer.gif’); // attachment
// $mail->AddAttachment(‘images/phpmailer_mini.gif’); // attachment
$mail->Send();

//sending message to admin

$to = $mailAddressto;
$subject = $subj;
$body = $description;

//$headers = “From: [email protected]\r\n”.
// “Reply-To: [email protected]\r\n”;

// connect to your Inbox through port 143. See imap_open() function for more details
$mbox = imap_open("{".$Host.":143/notls}", $Username, $Password);

// save the sent email to your Sent folder by just passing a string composed
// of the entire message + headers. See imap_append() function for more details.
// Notice the ‘r’ format for the date function, which formats the date correctly for messaging.

imap_append($mbox, “{”.$Host.":143/notls}INBOX.Sent",
“From: {$mailAddressfrom}\r\n”.
“To: “.$to.”\r\n”.
“Subject: “.$subject.”\r\n”.
“Date: “.date(“r”, strtotime(“now”)).”\r\n”.
“\r\n”.
$body.
“\r\n”
);

// close mail connection.
imap_close($mbox);

echo “Message Sent

\n”;
echo ‘GO BACK 2

’;
echo ‘GO BACK 3’;
} catch (phpmailerException $e) {
// echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
// echo $e->getMessage(); //Boring error messages from anything else!
}

}
?>[/php]

Name (from)

Name (to)

Email (from)

Email (to)

Subject (required)

i’m not sure but when the data is posted doesn’t it escape the quotes by adding the slashes so wouldn’t you change $_POST[‘maildsc’]; to stripslashes($_POST[‘maildsc’]); also i beleive you will need may also need to add the headers for html

$headers = “MIME-Version: 1.0\r\n”;
$headers .= “Content-Type: text/html; charset=ISO-8859-1\r\n”;

Thank you for taking the time to help me. It was greatly appreciated.
What actually ended up fixing the issue for me was replacing:

$description = $_POST[‘maildsc’];
with
$description = eregi_replace("[]",’’,$_POST[‘maildsc’]);

Sponsor our Newsletter | Privacy Policy | Terms of Service