Help with mail script

Any problem with PHP can be disscused here
Tails5
Posts: 1302
Joined: Wed Mar 15, 2006 8:09 am
Contact:

Help with mail script

Post 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]


Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti
Tails5
Posts: 1302
Joined: Wed Mar 15, 2006 8:09 am
Contact:

Sorry!

Post by Tails5 »

Sorry for double posting! You can delete this, but please fix my

Code: Select all

 tag on my thread, sorry.
Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti
reece
Posts: 55
Joined: Tue Apr 04, 2006 10:59 am

Post by reece »

On line 32 you have missed the $_POST var

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


should be

$text = Trim(stripslashes($_POST['Comments']));
jasondsouza
Posts: 348
Joined: Thu Jan 12, 2006 8:24 pm
Contact:

Post by jasondsouza »

i think that should be it..
--jasondsouza
ME working on a very new site. (Coming soon)
Come to my web Site
Tails5
Posts: 1302
Joined: Wed Mar 15, 2006 8:09 am
Contact:

Post 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]
Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti
Lixas
Posts: 750
Joined: Wed Feb 16, 2005 4:21 pm

Post 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]
Image
Tails5
Posts: 1302
Joined: Wed Mar 15, 2006 8:09 am
Contact:

Post by Tails5 »

It works great now, except for some reason the mail isnt arriving at my inbox.
Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti
Lixas
Posts: 750
Joined: Wed Feb 16, 2005 4:21 pm

Post 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
Image
Tails5
Posts: 1302
Joined: Wed Mar 15, 2006 8:09 am
Contact:

Post by Tails5 »

I've tried it on my other address, and it works, any suggestions on making it work with Hotmail?
Webmaster Yoda: You must confront the cPanel. Then, and only then, a webmaster will you be.
Julius Caesar: Veni, vidi, posti
Lixas
Posts: 750
Joined: Wed Feb 16, 2005 4:21 pm

Post by Lixas »

symptoms looks like that hotmail is blocking emails. check you spam settings, check spam / bulk folder, maybe your letter will be there ?
Image
Post Reply