Jump to content

Html Email Problem


phpretard

Recommended Posts

I just want to send an email via PHP that has a link instead of the href content.

 

I've searched the net and found complex information I don't need.  I am sure there is a simple way to accomplish this with the right knowledge (that I don't have).

 

Through searching I know it needs to have some type of headers but I don't know which.

 

 	$to = $Cemail;
$email="[email protected]";

$subject = "Registration";

$body.= "Message from: ".$company; 
$body.= "\n";
$body.= "\n";
$body.= "You Have Recently Registered With $company";
$body.= "\n";
$body.= "\n";
$body.= "Your Login Information is:";
$body.= "\n";
$body.= "\n";
$body.= "Username: ".$user ;
$body.= "\n";
$body.= "Password: ".$pass;
$body.= "\n";
$body.= "\n";
$body.="<a href='http://www.website.com?page=secure/main_login&customer=first&myusername=$user&mypassword=$pass>Click Here to login</a>";

mail( $to, $subject, $body, "From: $email");	

 

 

I would like the link to show up in the email like so:

 

Click Here to login and when you click it actually take you where you need to be.

 

All I can get it to do is deliver this:

<a href='http://www.website.com?page=secure/main_login&customer=first&myusername=$user&mypassword=$pass>Click Here to login</a>

 

 

Thanks for helping.

Link to comment
https://forums.phpfreaks.com/topic/104464-html-email-problem/
Share on other sites

U need to construct headers, and appart the from and reply to ones, ull need the content-type header. From the php.net mail() examples:

 

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "\r\n";
$headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n";
$headers .= 'Cc: [email protected]' . "\r\n";
$headers .= 'Bcc: [email protected]' . "\r\n";
$headers .= 'X-MAILER: PHP/' . phpversion();

Link to comment
https://forums.phpfreaks.com/topic/104464-html-email-problem/#findComment-534799
Share on other sites

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.