Page 1 of 1

Correct Syntax for this simple piece of code ?

Posted: Mon Mar 21, 2011 6:22 pm
by newphper
Hello Again,

Could anyone advise me as to the correct syntax for this code snippet please ?

It doesn't seem quite right where the 2nd last line line has $mesg = '<html>
Shouldn't it have either a closing inverted comma or possibly double quotes at start and finish of <html> ??

Here is the the code below

Code: Select all

//send the mail
mail($recipient, $subject, $mesg, $mailheaders);
}
else if($event_group_event == "yes")
{
$subject =$client_first_name;
$subject .= ", ";
if($client_gender ==  "male")
$subject .= $event_male_subject;
if($client_gender == "female")
$subject .= $event_female_subject;
$mesg = '<html>
<head>

Re: Correct Syntax for this simple piece of code ?

Posted: Tue Mar 22, 2011 10:20 am
by akuji36
Hello

Take a look at the following link:

http://www.fasthosts.co.uk/knowledge-ba ... icle_id=70

Re: Correct Syntax for this simple piece of code ?

Posted: Tue Mar 22, 2011 12:36 pm
by social_experiment
You want to encase the whole email body in quotes. Single or double doesn't really matter you just have to escape correctly if you are using any of the same quotation marks elsewhere inside $mseg.

Code: Select all

$mesg = '<html>
<head>
</head>
<body>
</body>
</html>';

Re: Correct Syntax for this simple piece of code ?

Posted: Tue Mar 22, 2011 11:04 pm
by newphper
Thank you for your help, that clears my problem up.