Page 1 of 2

Help with mail script

Posted: Mon Sep 24, 2007 3:19 am
by Tails5
I have a mail script on my server to submit links, but I keep getting the error:
Parse error: syntax error, unexpected '[', expecting ')' in /home/tails5t/public_html/submit.php on line 32
The source code is here:
[php]
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Send Mail</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.****">
<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">
<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\"><meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">
<!--mstheme--><link rel="stylesheet" type="text/css" href="_themes/zero/zero1111.css"><meta name="Microsoft Theme" content="zero 1111, default">
<meta name="Microsoft Border" content="none, default">
</head>

<body>

<p align="center"><!--webbot bot="Navigation" S-Type="banner"
S-Rendering="graphics" S-Orientation B-Include-Home B-Include-Up U-Page S-Target startspan
--><img src="_derived/send_mail.htm_cmp_zero110_bnr.gif" width="580" height="60" border="0" alt="Submit Link"><!--webbot bot="Navigation" endspan i-checksum="48039"
-->
</p>
<p align="center">Sending mail, please wait...</p>


<p align=center style='text-align:center'>Sending mail, please wait...<o:p></o:p></p>

<p align=center style='text-align:center'>

<?php
$EmailTo = "tails5is@hotmail.com";
$Subject = "Link submission";
$Name = Trim(stripslashes($_POST['Name']));
$email = Trim(stripslashes($_POST['email']));
$Website = Trim(stripslashes($_POST['Website']));
$text = Trim(stripslashes(['Comments']));
$validationOK=true;
if (!$validationOK) {
print "";
exit;

}

$Body = "" ;

$Body .= Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "e-mail:"
$Body .= $Address;
$Body .= "\n";
$Body .= "Phone: ";
$Body .= $Phone;
$Body .= "\n";
$Body .= "Website: ";
$Body .= $Website;
$Body .= "\n";
$Body .= "\n";
$Body .= "Description: ";
$Body .= $text;
$Body .= "\n"

$success = mail($EmailTo, $Subject, $Body,"From: <$email>");
if ($success){
print ""<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
print ""<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
</body>
</html>
[/php]

Sorry!

Posted: Mon Sep 24, 2007 3:28 am
by Tails5
Sorry for double posting! You can delete this, but please fix my

Code: Select all

 tag on my thread, sorry.

Posted: Mon Sep 24, 2007 10:03 am
by reece
On line 32 you have missed the $_POST var

$text = Trim(stripslashes(['Comments']));


should be

$text = Trim(stripslashes($_POST['Comments']));

Posted: Mon Sep 24, 2007 10:06 pm
by jasondsouza
i think that should be it..

Posted: Tue Sep 25, 2007 10:12 am
by Tails5
Okay, that error's fixed, but I've got a new one that I don't understand, because $email is defined. Now I'm getting:
Parse error: syntax error, unexpected T_VARIABLE in /home/tails5t/public_html/submit.php on line 45
Here is the code:[php]
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Send Mail</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.****">
<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">
<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\"><meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">
<!--mstheme--><link rel="stylesheet" type="text/css" href="_themes/zero/zero1111.css"><meta name="Microsoft Theme" content="zero 1111, default">
<meta name="Microsoft Border" content="none, default">
</head>

<body>

<p align="center"><!--webbot bot="Navigation" S-Type="banner"
S-Rendering="graphics" S-Orientation B-Include-Home B-Include-Up U-Page S-Target startspan
--><img src="_derived/send_mail.htm_cmp_zero110_bnr.gif" width="580" height="60" border="0" alt="Submit Link"><!--webbot bot="Navigation" endspan i-checksum="48039"
-->
</p>
<p align="center">Sending mail, please wait...</p>


<p align=center style='text-align:center'>Sending mail, please wait...<o:p></o:p></p>

<p align=center style='text-align:center'><?php
$EmailTo = "tails5is@hotmail.com";
$Subject = "Link submission";
$Name = Trim(stripslashes($_POST['Name']));
$email = Trim(stripslashes($_POST['email']));
$Website = Trim(stripslashes($_POST['Website']));
$text = Trim(stripslashes($_POST['describe']));
$validationOK=true;
if (!$validationOK) {
print "";
exit;
}

$Body = "" ;
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "\n";
$Body .= "e-mail: "
$Body .= $email;
$Body .= "\n";
$Body .= "\n";
$Body .= "Website: ";
$Body .= $Website;
$Body .= "\n";
$Body .= "\n";
$Body .= "Description: ";
$Body .= "\n";
$Body .= $text;
$Body .= "\n"

$success = mail($EmailTo, $Subject, $Body,"From: <$email>");
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
print ""<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
</body>
</html>
[/php]

Posted: Wed Sep 26, 2007 1:32 pm
by Lixas
you forgot ; in few places. Now script is without any php errors
[PHP]<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Send Mail</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.****">
<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">
<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\"><meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">
<!--mstheme--><link rel="stylesheet" type="text/css" href="_themes/zero/zero1111.css"><meta name="Microsoft Theme" content="zero 1111, default">
<meta name="Microsoft Border" content="none, default">
</head>

<body>

<p align="center"><!--webbot bot="Navigation" S-Type="banner"
S-Rendering="graphics" S-Orientation B-Include-Home B-Include-Up U-Page S-Target startspan
--><img src="_derived/send_mail.htm_cmp_zero110_bnr.gif" width="580" height="60" border="0" alt="Submit Link"><!--webbot bot="Navigation" endspan i-checksum="48039"
-->
</p>
<p align="center">Sending mail, please wait...</p>


<p align=center style='text-align:center'>Sending mail, please wait...<o:p></o:p></p>

<p align=center style='text-align:center'><?php
$EmailTo = "tails5is@hotmail.com";
$Subject = "Link submission";
$Name = Trim(stripslashes($_POST['Name']));
$email = Trim(stripslashes($_POST['email']));
$Website = Trim(stripslashes($_POST['Website']));
$text = Trim(stripslashes($_POST['describe']));
$validationOK=true;
if (!$validationOK) {
print "";
exit;
}

$Body = "" ;
$Body .= "Name: ";
$Body .= $Name;
$Body .= "\n";
$Body .= "\n";
$Body .= "e-mail: ";
$Body .= $email;
$Body .= "\n";
$Body .= "\n";
$Body .= "Website: ";
$Body .= $Website;
$Body .= "\n";
$Body .= "\n";
$Body .= "Description: ";
$Body .= "\n";
$Body .= $text;
$Body .= "\n";

$success = mail($EmailTo, $Subject, $Body,"From: <$email>");
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
</body>
</html>[/PHP]

Posted: Wed Sep 26, 2007 11:51 pm
by Tails5
It works great now, except for some reason the mail isnt arriving at my inbox.

Posted: Sat Sep 29, 2007 7:04 am
by Lixas
Tails5 wrote:It works great now, except for some reason the mail isnt arriving at my inbox.
have you tried another mail box ? Or maybe your server is blocking "mail" function

Posted: Sun Sep 30, 2007 8:06 am
by Tails5
I've tried it on my other address, and it works, any suggestions on making it work with Hotmail?

Posted: Sun Sep 30, 2007 1:23 pm
by Lixas
symptoms looks like that hotmail is blocking emails. check you spam settings, check spam / bulk folder, maybe your letter will be there ?