Forum Moderators: coopster

Message Too Old, No Replies

parse error, unexpected T-VARIABLE with mail function

         

jzsouthern

7:08 pm on Nov 21, 2003 (gmt 0)

10+ Year Member



Sorry for the basic question, but I am a relatively new PHP programmer, and I can't for the life of me get past this error.

The error I am getting is:

Parse error: parse error, unexpected T_VARIABLE in /home/virtual/site4/fst/var/www/html/FilterReminders/mail.php3 on line 49

Here is the code that it is referencing. I'm modifying an email reminder program to send an Multipart/Alternative HTML message. I've checked the syntax like 10 times, so I am really at a loss:

if ($recurring==""){
$addcomment="\n\n-----\nThis was a ONE-TIME non-recurring Email Reminder.\n";
$addcomment.="You can disable this or find your password by going to $site.\n\n";
} else {
$addcomment="\n\n-----\nThis is a CONTINUOUSLY recurring Email Reminder.\n";
$addcomment.="You can disable this or find your password by going to $site.\n\n";
}

/* E-mail reminder */
$htmlmessage="------------9C7B2CD8BA69A1C0C781C6F\nContent-Type: text/html; Charset=us-ascii\nContent-Transfer-Encoding: 8bit\n\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n<html>\n<head>\n<title>Four Seasons Heating and Home Comfort Solutions</title>\n<meta http-equiv=\"Content-Type\" content:\"text/html; charset=iso-8859-1\">\n</head>\n<body bgcolor=#FFFFFF leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>\n<table width=506 border=0 cellpadding=0 cellspacing=0>\n<tr>\n<td colspan=3><img src=\"http://www.site.com/emails/images/title.gif\" width=506 height=113></td>\n</tr>\n<tr>\n<td><img src=\"http://www.site.com/emails/images/left.gif\" width=50 height=328></td>\n<td background=\"http://www.site.com/emails/images/content_bg.gif\"><font size=2 face=\"Verdana, Arial, Helvetica, sans-serif\">";
$htmlfooter="</font></td>\n<td><img src=\"http://www.site.com/emails/images/right.gif\" width=49 height=328></td></tr>\n</table>\n</body>\n</html>\n\n------------9C7B2CD8BA69A1C0C781C6F--";
$textmessage="------------9C7B2CD8BA69A1C0C781C6F\nContent-Type: text/plain; Charset=us-ascii\nContent-Transfer-Encoding: 8bit\n\n";
$message = $textmessage.$comment.$addcomment.$htmlmessage.$comment.$addcomment.$htmlfooter;
$headers = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: multipart/alternative;boundary=\"------------9C7B2CD8BA69A1C0C781C6F\" \r\n";
$headers.= "X-Priority: 1\r\n";
$headers.= "X-MSMail-Priority: High\r\n";
$headers.= "X-Mailer: php\r\n";
$headers.= "From: Four Seasons Email Reminders <reminders@site.com>\r\n";

mail ($email, $subject, $message, $headers);

echo "Sent mail to: $email\n";

[edited by: jatar_k at 7:35 pm (utc) on Nov. 21, 2003]
[edit reason] generalized domain name [/edit]

figment88

7:17 pm on Nov 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You have problems with double quotes.

Either assign the string to a php variable using single quotes or escape the pass-thru ones.

e.g
you have
$htmlmessage="------------9C7B2CD8BA69A1C0C781C6F\nContent-Type: text/html; Charset=us-ascii\nContent-Transfer-Encoding: 8bit\n\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD ...

change it to
$htmlmessage='------------9C7B2CD8BA69A1C0C781C6F\nContent-Type: text/html; Charset=us-ascii\nContent-Transfer-Encoding: 8bit\n\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD ...

jzsouthern

7:24 pm on Nov 21, 2003 (gmt 0)

10+ Year Member



One other bit of info, when I take out the $headers definition, the script works, so the problem must be somewhere in those definitions? Have I concatenated wrong?

jzsouthern

7:31 pm on Nov 21, 2003 (gmt 0)

10+ Year Member



Got it, thanks. I actually noticed that when I pasted it into the text box here, there were some extra spaces before a couple of the $headers lines...