Jump to content

[SOLVED] urlencode embedded into emails???


shadiadiph

Recommended Posts

I am having problems maybe I am going about it the wrong way I ca get people to sign up ok and it adds the data to my sql datbase fine but the email it generates doesn't work properly links in the email go nowhere and do not work.

It is a confirmation email which will link to a php page which will change a value in my database that page will be easy for me to do but this is FREAKING me out maybe I am just too tired.

Here is my code any help will be much appreciated.

 

<?
$name       		=     stripslashes($_POST["name"]);
$email			=	stripslashes($_POST["email"]);

$to = "$email";
$subject = "$name Please confirm subscription to our newsletter";
$MsgHeader = "From: Asia Pacific Advisors<[email protected].> \n";
$MsgHeader .= "MIME-Version: 1.0\n";
$MsgHeader .= "Content-type: text/html; charset=iso-8859-1";
$MsgBody = "
<html>
<head>
<title>HTML message</title>

</head>
<body>
</form>
<table>
<input type='hidden' name='name' value='$name' />
<input type='hidden' name='name' value='$email' />
<tr><td align='left'><img src='http://www.website.com/pix/apalogo.jpg'></td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Dear $name</font></td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Your subscription to our newsletter at website.com. has been received</font></td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Please <a href='http:/www.website.com/newsletter_confirm.php?eid=<?=urlencode('$email')?>&nid=<?=urlencode('$name')?>&Sid=<?=urlencode('Y')?>'>click here</a> to activate your subscription.</font></td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>This message has been automatically generated please do not reply to this email.</font></td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 11px' style='font-color: #336699' style='font-family: Tahoma, Arial'>This message, and any attachments, is intended only for the use of the individual or entity to which it is addressed, and may contain confidential, proprietary and/or privileged information that is exempt from disclosure under applicable law which is not waived or lost by any transmission failure. 
If the reader of this message is not the intended recipient or its employee, or agent responsible for delivering the message to the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this communication and any attachments hereto is strictly prohibited. 
If you have received this communication in error, please destroy this message. 
Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of another person or entity. </font></td></tr>
</table>
</form>
</body>
</html>";
mail($to, $subject, $MsgBody, $MsgHeader);
?>


Link to comment
https://forums.phpfreaks.com/topic/136033-solved-urlencode-embedded-into-emails/
Share on other sites

Hi here is the whole php script the first part works fine and writes to the database i left off the bottom part below this which is all html the problem is the email part. This is the submit data form from another page where the user enteres his name and email.

 


<? 
session_start();
error_reporting(apa);
?>
<?PHP
include("secure/p/global/connection.php");
include("secure/p/global/mail.class.php");
error_reporting(7);

$name       		=     stripslashes($_POST["name"]);
$email			=	stripslashes($_POST["email"]);



	$checkuser 			="select intUserID from tblnewsletteruserdetails where email='$email'";
	$temps	= $DB_site->query($checkuser);
	$total	= $DB_site->num_rows($temps);

	if ($total>0)
	{
?>
		<script>
			alert("This email address is already registered. Please try a defferent email address or contact us.")
			history.back()
		</script>
<?
	}
	else
	{
		$insertsql = " insert into tblnewsletteruserdetails (name, email,subscribed,dtAddedOn) values ('".addslashes($name)."', '".addslashes($email)."', '".addslashes('N')."','".date("y-m-d h:m:s")."')";

		$DB_site->query($insertsql);
		$userid = mysql_insert_id();


?>
<?

$to = "[email protected]";
$subject = "Newsletter SignUp On APA";
$MsgHeader = "From: APA <[email protected]> \n";
$MsgHeader .= "MIME-Version: 1.0\n";
$MsgHeader .= "Content-type: text/html; charset=iso-8859-1";
$MsgBody = "
<html>
<head>
<title>HTML message</title>

</head>
<body>
<table>
<tr><td align='left'><img src='http://www.website.com/pix/apalogo.jpg'></td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Dear Administrator</font></td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>$name with email $email has signed up for the newsletter at website.com</font></td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>
Regards</font></td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>
APA Website Monitor</font></td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 11px' style='font-color: #336699' style='font-family: Tahoma, Arial'>This message, and any attachments, is intended only for the use of the individual or entity to which it is addressed, and may contain confidential, proprietary and/or privileged information that is exempt from disclosure under applicable law which is not waived or lost by any transmission failure. 
If the reader of this message is not the intended recipient or its employee, or agent responsible for delivering the message to the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this communication and any attachments hereto is strictly prohibited. 
If you have received this communication in error, please destroy this message. 
Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of another person or entity. </font></td></tr>
</table>

</body>
</html>";
mail($to, $subject, $MsgBody, $MsgHeader);
?>		

<?
$name       		=     stripslashes($_POST["name"]);
$email			=	stripslashes($_POST["email"]);

$to = "$email";
$subject = "$name Please confirm subscription to our newsletter";
$MsgHeader = "From: APA<[email protected]> \n";
$MsgHeader .= "MIME-Version: 1.0\n";
$MsgHeader .= "Content-type: text/html; charset=iso-8859-1";
$MsgBody = "
<html>
<head>
<title>HTML message</title>

</head>
<body>
</form>
<table>
<input type='hidden' name='name' value='$name' />
<input type='hidden' name='name' value='$email' />
<tr><td align='left'><img src='http://www.website.com/pix/apalogo.jpg'></td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Dear $name</font></td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Your subscription to our newsletter at website.com has been received</font></td></tr>
<tr><td> </td></tr>
<tr><td><tr><td> </td></tr><a href="http:/www.website.com/newsletter_confirm.php?eid=" . urlencode($email) . "&nid=" . urlencode($name) . "&sid=" . urlencode('Y') .">Click here</a>
</font></td></tr><tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>If you have received this email by mistake we apologise and please <a>click here</a> to delete your details from our database.</font></td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>
Best Regards</font></td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>
APA Team</font></td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>This message has been automatically generated please do not reply to this email.</font></td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 11px' style='font-color: #336699' style='font-family: Tahoma, Arial'>This message, and any attachments, is intended only for the use of the individual or entity to which it is addressed, and may contain confidential, proprietary and/or privileged information that is exempt from disclosure under applicable law which is not waived or lost by any transmission failure. 
If the reader of this message is not the intended recipient or its employee, or agent responsible for delivering the message to the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this communication and any attachments hereto is strictly prohibited. 
If you have received this communication in error, please destroy this message. 
Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of another person or entity. </font></td></tr>
</table>
</form>
</body>
</html>";
mail($to, $subject, $MsgBody, $MsgHeader);
?>

I must have been too tired yesterday here is the solution for it it was so simple got it all working now.  ;)

 


<?

$to = "$email";
$subject = "$name Please Confirm Your Newsletter Signup on Website Name";
$MsgHeader = "From: Website Name <[email protected]> \n";
$MsgHeader .= "MIME-Version: 1.0\n";
$MsgHeader .= "Content-type: text/html; charset=iso-8859-1";
$MsgBody = "
<html>
<head>
<title>HTML message</title>

</head>
<body>
<table>
<tr><td align='left'><img src='http://www.website.com/pix/apalogo.jpg'></td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Dear $name,</font></td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>To confirm your newslwtter subscription at website.com</font></td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>Please <a href='http://www.website.com/newsletter_confirm.php?eid=$email&nid=Y&act=activate' 'target_new' >click here</a> to validate.</font></td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>
Regards</font></td></tr>
<tr><td><font style='font-size: 13px' style='font-family: Tahoma, Arial'>
Website Team</font></td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td><font style='font-size: 11px' style='font-color: #336699' style='font-family: Tahoma, Arial'>This message, and any attachments, is intended only for the use of the individual or entity to which it is addressed, and may contain confidential, proprietary and/or privileged information that is exempt from disclosure under applicable law which is not waived or lost by any transmission failure. 
If the reader of this message is not the intended recipient or its employee, or agent responsible for delivering the message to the intended recipient, you are hereby notified that any use, dissemination, distribution or copying of this communication and any attachments hereto is strictly prohibited. 
If you have received this communication in error, please destroy this message. 
Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorised to state them to be the views of another person or entity. </font></td></tr>
</table>

</body>
</html>";
mail($to, $subject, $MsgBody, $MsgHeader);
?> 

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.