PHP Email with Links

Hi,

I’ve been looking online for how to do this, but am getting more and more confused. I have made a form that writes to a DB with SQL and sends two emails, one to the company one too the customer upon registration.

It all works fine, except I need to put a link to a PDF on this email, but can’t get it to work. The link just appeears in the email in plain text. I’ve read that I need to use headers to set the email to HTML instead of plain text, but I can’t get it to work. Can anyone please help me.

Many thanks,

Ben

[php]
if(($exp_first_name == 1)&&($exp_surname == 1)&&($exp_email == 1)&&($exp_street_address == 1)&&($exp_town == 1)&&($exp_postcode == 1)&&($exp_mobile == 1))
{

$email_to = "$email"; 		// Correct for when testing is over.
//$email_to = "[email protected]";		// Where email is delivered to
$email_subject = "Welcome to Bootcamp";		// Email subject
$email_from = "LM Bootcamp";		// Who the email shows as from

$email_message .= "Congratulations for joining Bootcamp\n\n";
$email_message .= "Your details were added as below:\n";
$email_message .= "Name: ".$first_name." ".$surname."\n";
$email_message .= "Email: ".$email."\n";
$email_message .= "Phone Number: ".$mobile."\n";
$email_message .= "Address: ".$street_address.", ".$town.", ".$postcode."\n";
$email_message .= "Bootcamp Location: ".$location."\n\n";

$email_message .= "Please use the link below to download the final forms.\n\n";

$email_message .= '<a href=\"#\">Linky</a>\n\n';


    $headers  = 'MIME-Version: 1.0' . "\r\n";
$headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);


}

unset($email_message);

[/php]

Well, a link in a HTML-email is just link any other link. You place the inside part of the HREF to point to the website and link and the outside part of the HREF to tell them to click-here for the PDF… Very simple.
So, change this:
<a href="#">Linky\n\n’;
To something like this:
<a HREF=“www.youdomain.com\yourfolder\yourpdf.pdf”>Press here to read our manual!\n\n’;

Of course, change this info to include the correct pointer to your pdf file on your site. Should work for you!

Sponsor our Newsletter | Privacy Policy | Terms of Service