Jump to content

Parse error...


Skeleten Neteleks

Recommended Posts

Hi, I'm using a PHP mailer script which I have used before successfully. However, now that I've configured the html output of the email message, I get this error:

[quote]Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /usr/local/psa/home/vhosts/adkm.34sp.com/httpdocs/output.php on line 203[/quote]

I'm not sure where the extra whitespace is... please help!

[code]
<?php
function wpautop($pee, $br = 1) {
        $pee = $pee . "\n"; // just to make things a little easier, pad the end
        $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
        // Space things out a little
        $pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
        $pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n\n", $pee);
        $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
        $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
        $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
        $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
        $pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
        $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
        $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
        $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
        $pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee);
        $pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee);
        if ($br) $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee);

        $pee = preg_replace('!(</?(?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);
        $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)!', '$1', $pee);
        $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') .  stripslashes(clean_pre('$2'))  . '</pre>' ", $pee);

        return stripslashes($pee);
}
    //change this to your email.
    $to = "myemail@hotmail.com";
    $from = "noreply";
    $subject = "$email's Job Search Evidence - $centre - $date";

$name = $_POST['name'];
$date = $_POST['date'];
$centre = $_POST['centre'];
$email = $_POST['email'];
$sitesandpapers = wpautop($_POST['sitesandpapers']);
$phcompany1 = $_POST['phcompany1'];
$phcompany2 = $_POST['phcompany2'];
$phcompany3 = $_POST['phcompany3'];
$phname1 = $_POST['phname1'];
$phname2 = $_POST['phname2'];
$phname3 = $_POST['phname3'];
$phnumber1 = $_POST['phnumber1'];
$phnumber2 = $_POST['phnumber2'];
$phnumber3 = $_POST['phnumber3'];
$phpurpose1 = $_POST['phpurpose1'];
$phpurpose2 = $_POST['phpurpose2'];
$phpurpose3 = $_POST['phpurpose3'];
$phresult1 = $_POST['phresult1'];
$phresult2 = $_POST['phresult2'];
$phresult3 = $_POST['phresult3'];
$updatedcv = $_POST['updatedcv'];
$jobsearchactivities = wpautop($_POST['jobsearchactivities']);
$appcom1 = $_POST['appcom1'];
$appcom2 = $_POST['appcom2'];
$appcom3 = $_POST['appcom3'];
$appcom4 = $_POST['appcom4'];
$appcom5 = $_POST['appcom5'];
$appcom6 = $_POST['appcom6'];
$appmet1 = $_POST['appmet1'];
$appmet2 = $_POST['appmet2'];
$appmet3 = $_POST['appmet3'];
$appmet4 = $_POST['appmet4'];
$appmet5 = $_POST['appmet5'];
$appmet6 = $_POST['appmet6'];
$apppos1 = $_POST['apppos1'];
$apppos2 = $_POST['apppos2'];
$apppos3 = $_POST['apppos3'];
$apppos4 = $_POST['apppos4'];
$apppos5 = $_POST['apppos5'];
$apppos6 = $_POST['apppos6'];
$appsent1 = $_POST['appsent1'];
$appsent2 = $_POST['appsent2'];
$appsent3 = $_POST['appsent3'];
$appsent4 = $_POST['appsent4'];
$appsent5 = $_POST['appsent5'];
$appsent6 = $_POST['appsent6'];
$appsent7 = $_POST['appsent7'];
$appsent8 = $_POST['appsent8'];
$appsent9 = $_POST['appsent9'];
$appsent10 = $_POST['appsent10'];
$appsent11 = $_POST['appsent11'];
$appsent12 = $_POST['appsent12'];
$appsent13 = $_POST['appsent13'];
$appsent14 = $_POST['appsent14'];
$appsent15 = $_POST['appsent15'];
$appsent16 = $_POST['appsent16'];
$appsent17 = $_POST['appsent17'];
$appsent18 = $_POST['appsent18'];
$appsent19 = $_POST['appsent19'];
$appsent20 = $_POST['appsent20'];
$appsent21 = $_POST['appsent21'];
$appsent22 = $_POST['appsent22'];
$appsent23 = $_POST['appsent23'];
$appsent24 = $_POST['appsent24'];
$appdatesent1 = $_POST['appdatesent1'];
$appdatesent2 = $_POST['appdatesent2'];
$appdatesent3 = $_POST['appdatesent3'];
$appdatesent4 = $_POST['appdatesent4'];
$appdatesent5 = $_POST['appdatesent5'];
$appdatesent6 = $_POST['appdatesent6'];
$appaddress1 = wpautop($_POST['appaddress1']);
$appaddress2 = wpautop($_POST['appaddress2']);
$appaddress3 = wpautop($_POST['appaddress3']);
$appaddress4 = wpautop($_POST['appaddress4']);
$appaddress5 = wpautop($_POST['appaddress5']);
$appaddress6 = wpautop($_POST['appaddress6']);
    //begin of HTML message
    $message =
<<<EOF
<html>
<head>
<style type="text/css">
body, td { background-color: white; font-family: Arial; font-size: 12px; color: black; }
</style>
</head>
<body>
<table width="600" cellpadding="5" style="border: 3 double black">
<tr>
<td style="font-size: 16px"><strong>$email's</strong> Job Search Evidence</td>
<td align="right" style="font-size: 16px"><strong>$centre - $date</strong></td>
</tr>
</table>
<div style="margin-left: 11px">
<p><strong>Web sites and newspapers:</strong>
<br><font color="blue">$sitesandpapers</font>
<p><strong>Phone Calls</strong>
<br><table width="600">
<tr>
<td>Company #1</td><td><font color="blue">$phcompany1</font></td>
<td>Company #2</td><td><font color="blue">$phcompany2</font></td>
<td>Company #3</td><td><font color="blue">$phcompany3</font></td>
</tr>
<tr>
<td>Spoke to:</td><td><font color="blue">$phname1</font></td>
<td>Spoke to:</td><td><font color="blue">$phname2</font></td>
<td>Spoke to:</td><td><font color="blue">$phname3</font></td>
</tr>
<tr>
<td>Number:</td><td><font color="blue">$phnumber1</font></td>
<td>Number:</td><td><font color="blue">$phnumber2</font></td>
<td>Number:</td><td><font color="blue">$phnumber3</font></td>
</tr>
<tr>
<td>Purpose:</td><td><font color="blue">$phpurpose1</font></td>
<td>Purpose:</td><td><font color="blue">$phpurpose2</font></td>
<td>Purpose:</td><td><font color="blue">$phpurpose3</font></td>
</tr>
<tr>
<td>Result:</td><td><font color="blue">$phresult1</font></td>
<td>Result:</td><td><font color="blue">$phresult2</font></td>
<td>Result:</td><td><font color="blue">$phresult3</font></td>
</tr>
</table>
<p><strong>Other job search activities:</strong>
<br><font color="blue">$jobsearchactivities</font>
<p><strong>Applications</strong>
<br><table width="600">
<tr>
<td>
Company #1: <font color="blue">$appcom1</font> / Method: <font color="blue">$appmet1</font> / Position: <font color="blue">$apppos1</font>
<br>Sent: <font color="blue">$appsent1 $appsent2 $appsent3 $appsent4</font> / Date: <font color="blue">$appdatesent1</font>
<br>Address: <font color="blue">$appaddress1</font></td>
</tr>
<tr>
<td>Company #2: <font color="blue">$appcom2</font> / Method: <font color="blue">$appmet2</font> / Position: <font color="blue">$apppos2</font>
<br>Sent: <font color="blue">$appsent5 $appsent6 $appsent7 $appsent8</font> / Date: <font color="blue">$appdatesent2</font>
<br>Address: <font color="blue">$appaddress2</font></td>
</tr>
<tr>
<td>Company #3: <font color="blue">$appcom3</font> / Method: <font color="blue">$appmet3</font> / Position: <font color="blue">$apppos3</font>
<br>Sent: <font color="blue">$appsent9 $appsent10 $appsent11 $appsent12</font> / Date: <font color="blue">$appdatesent3</font>
<br>Address: <font color="blue">$appaddress3</font></td>
</tr>
<tr>
<td>Company #4: <font color="blue">$appcom4</font> / Method: <font color="blue">$appmet4</font> / Position: <font color="blue">$apppos4</font>
<br>Sent: <font color="blue">$appsent13 $appsent14 $appsent15 $appsent16</font> / Date: <font color="blue">$appdatesent4</font>
<br>Address: <font color="blue">$appaddress4</font></td>
</tr>
<tr>
<td>Company #5: <font color="blue">$appcom5</font> / Method: <font color="blue">$appmet5</font> / Position: <font color="blue">$apppos5</font>
<br>Sent: <font color="blue">$appsent17 $appsent18 $appsent19 $appsent20</font> / Date: <font color="blue">$appdatesent5</font>
<br>Address: <font color="blue">$appaddress5</font></td>
</tr>
<tr>
<td>Company #6: <font color="blue">$appcom6</font> / Method: <font color="blue">$appmet6</font> / Position: <font color="blue">$apppos6</font>
<br>Sent: <font color="blue">$appsent21 $appsent22 $appsent23 $appsent24</font> / Date: <font color="blue">$appdatesent6</font>
<br>Address: <font color="blue">$appaddress6</font></td>
</tr>
<tr>
<td align="right" style="padding-right: 50px"><input type="button" value="Print" onclick="window.print()"></td>
</tr>
</table>
</div>
</body>
</html>
EOF;
    //end of message
    $headers  = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";

    //options to send to cc+bcc
    $headers .= "Cc: [email]$email[/email]";
    //$headers .= "Bcc: [email][/email]";
    header("Location: http://thankyou/");

    // now lets send the email.
    mail($to, $subject, $message, $headers);
?>[/code]
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.