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="registration@website.com";

$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
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 <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
$headers .= 'X-MAILER: PHP/' . phpversion();

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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