Jump to content

how to insert link inside a html message using mail()


ok

Recommended Posts

hi guys

 

i have these message content of an email using mail() below,

 

$message = "
<html>
<head>
</head>
<body>
<h3>Dear $ffname,</h3><br>
Your friend $ufname $ulname is inviting you to join a $50 dollar gas card.<br>
?>
<a href=\"<?php echo $tmp_dir; ?>ureferer=$ufull_name \"><h4><h4>Please Click here to join!</h4></a>
<?php
Join now and be a candidate to win the $50 dollar gas card every week.<br>
For more details please visit the link.<br><br>
<h4>Thank you!</h4>
</body>
</html>";

 

actually i'm trying to insert a link inside the message of an email  which is html format and that will carry a variable value.

 

but it's not working.

 

can you show me the right way please

 

thanks.

 

using the mail() function, you would need to define the message as html/text, then insert the proper delimiters to identify the portion of the mail message that is HTML. I skip all that and use the very excellent htmlmimemail.php from here:

 

http://www.phpguru.org/static/mime.mail.html

 

there are examples on the site and included with the download. essentially create the object, set the HTML value to the HTML you want to send, then send it to your list of recipients.

does this help

//send an email here?
  
  $body = "Hi\n
  
email body here\n
.\n

website: http://www.site.com.com
Username: {$_POST['username']}\n
Password: {$_POST['password']}\n
  
";


	mail($_POST['email'], 'subject line here'  , $body, 'From: [email protected]');

 

^ that still won't work, as you haven't set the proper email headers to tell the email reading application that the included content is HTML.

 

as i stated before: if you don't want to mess with setting the proper headings and delimiting MIME boundaries, you're better off using the existing htmlmimemail code.

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.