Jump to content

Formatting an email (Very simple question probably)


dc_jt

Recommended Posts

Hi I want to format the following so that each heading is in bold how would I do that:

 

Also I want to add a title at the beginning (where I have put TITLE HERE)

 

$message = 'The following information has been submitted through the contact form:'."\n"."\n". (TITLE HERE) 'Type of Enquiry: ' .$enquiry_type."\n". 'Title: ' .$title."\n". 'First Name: ' .$first_name."\n". 'Surname: ' .$surname."\n". 'Email: '.$email."\n". 'Address: '.$address."\n". 'City/Town: '.$city_town."\n". 'County: '.$county."\n".'Postcode: '.$postcode."\n". 'Telephone: '.$telephone."\n". 'Mobile: '.$mobile."\n". 'Telephone: '.$telephone."\n". 'How did you hear about us?: '.$heard_from."\n". 'Areas of Interest: '.$areas_of_interest[0].$areas_of_interest[1].$areas_of_interest[2].$areas_of_interest[3].$areas_of_interest[4]. 'Enquiry: '.$enquiry."\n". 'E-News Signup: '.$newsletter;

 

Thanks

 

Link to comment
Share on other sites

You can add the code <b>TEXT</b> directly into the quotes for the titles, but then you have to change the headers of the email so that it knows it is HTML.

 

I use the following function (which you pass $message to):

 

<?php
function sendmail($to,$subject,$pagetext,$from="noreply@domain.com") {
$headers = "";
    mail($to,$subject,$pagetext,"From: $from\nReply-To: $from\nX-Mailer: PHP/".phpversion()."\nContent-type: text/html");
}
?>

 

Hope that helps.

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.