943,948 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 664
  • PHP RSS
Oct 2nd, 2008
0

Mail() returning parse error

Expand Post »
Code:
[<?php
Mail(“info@dating-advice-for-women.com”, “This is the message subject”, “This is the message body”);
?>]

Error message:
"Parse error: syntax error, unexpected '@' in /home/dating8/public_html/newland/messagesent.php on line 2"

The server is SMTP email-enabled and the folder on the server has permission to send SMTPmail messages.

The hosting company reply:
"Please ensure your scipt has the SMTP information specifically in it so it is passing the properly directives. Any scripts executing on the server should be permissions of 755 as should the directory they are located in generally."

My question:
How do I include the SMTP specifically in the script?

Thank you.

Br,
Christian
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Maverick2608 is offline Offline
5 posts
since Oct 2008
Oct 2nd, 2008
0

Re: Mail() returning parse error

Code:
[<?php
Mail(“info@dating-advice-for-women.com”, “This is the message subject”, “This is the message body”);
?>]

Error message:
"Parse error: syntax error, unexpected '@' in /home/dating8/public_html/newland/messagesent.php on line 2"

The server is SMTP email-enabled and the folder on the server has permission to send SMTPmail messages.

The hosting company reply:
"Please ensure your scipt has the SMTP information specifically in it so it is passing the properly directives. Any scripts executing on the server should be permissions of 755 as should the directory they are located in generally."

My question:
How do I include the SMTP specifically in the script?

Thank you.

Br,
Christian
This has nothing to do with file permissions or that line of code that you have posted. The error is at messagesent.php around line 2. It is as simple as that. Post your code from messagesent.php.
Last edited by R0bb0b; Oct 2nd, 2008 at 11:32 am.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008
Oct 2nd, 2008
0

Re: Mail() returning parse error

Here is the entire code for messagesent.php:

[<?php
Mail(“info@dating-advice-for-women.com”, “This is the message subject”, “This is the message body”);
?>]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Newland Tours: About</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/newland.css" rel="stylesheet" type="text/css" /></head>

<body>
<a href="#top"><img src="images/spacer.gif" alt="Skip to main page content" width="1" height="1" border="0" align="left" /></a>
<table width="750" border="0" cellpadding="3" cellspacing="0">
<tr>
<td><img src="images/banner_left.gif" width="451" height="68" alt="Newland Tours Banner, Left." /></td>
<td width="280"><img src="images/banner_right.jpg" width="276" height="68" alt="Newland Tour Banner, Right." /></td>
</tr>
<tr>
<td><img src="images/navbar.gif" name="navbar" width="450" height="20" border="0" usemap="#navbarMap" alt="Navigation Bar." /></td>
<td><img name="copyright_bar" src="images/copyright_bar.gif" width="272" height="20" border="0" alt="Copyright 2006 Newland Tours." /></td>
</tr>
<tr>
<td colspan="2">
<h1><br />
<a name="top" id="top"></a>Message Sent </h1>
<p>Your message has been sent. You should hear from us within two days. </p>
<p>Return to Newland <a href="index.php">home</a>. </p></td>
</tr>
</table>

<br />


<map name="navbarMap" id="navbarMap">
<area shape="rect" coords="1,0,62,20" href="index.php" alt="Home" />
<area shape="rect" coords="71,0,117,20" href="about.php" alt="About" />
<area shape="rect" coords="129,0,196,20" href="tours.php" alt="Find Tours" />
<area shape="rect" coords="209,0,311,20" href="profiles.php" alt="Country Profiles" />
<area shape="rect" coords="327,0,434,20" href="contact.php" alt="Contact An Agent" />
</map>
</body>
</html>
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Maverick2608 is offline Offline
5 posts
since Oct 2008
Oct 2nd, 2008
0

Re: Mail() returning parse error

unless you have defined the function called "Mail()" then you need to use "mail()" because function names are case sensitive.
Last edited by R0bb0b; Oct 2nd, 2008 at 12:11 pm.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008
Oct 2nd, 2008
0

Re: Mail() returning parse error

I have changed "Mail" to "mail" and uploaded. I still receive the same error message.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Maverick2608 is offline Offline
5 posts
since Oct 2008
Oct 2nd, 2008
0

Re: Mail() returning parse error

I have now written it like this instead:
<?php
$to = "info@dating-advice-for-women.com";
$subject = "subject";
$body = "body";
$headers = "From: "info@dating-advice-for-women.com\n";
mail($to,$subject,$body,$headers);
?>
I now reive this error instead:
Parse error: syntax error, unexpected T_STRING in /home/dating8/public_html/newland/messagesent.php on line 5

I read somewhere else that it means there is one to many spaces. I will check it out.

I will credit you.

Thank you so much.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Maverick2608 is offline Offline
5 posts
since Oct 2008
Oct 2nd, 2008
0

Re: Mail() returning parse error

I have now written it like this instead:
<?php
$to = "info@dating-advice-for-women.com";
$subject = "subject";
$body = "body";
$headers = "From: "info@dating-advice-for-women.com\n";
mail($to,$subject,$body,$headers);
?>
I now reive this error instead:
Parse error: syntax error, unexpected T_STRING in /home/dating8/public_html/newland/messagesent.php on line 5

I read somewhere else that it means there is one to many spaces. I will check it out.

I will credit you.

Thank you so much.
the error is here
php Syntax (Toggle Plain Text)
  1. $headers = "From: "info@dating-advice-for-women.com\n";
  2.  

this needs to be
php Syntax (Toggle Plain Text)
  1. $headers = "From: info@dating-advice-for-women.com\n";
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008
Oct 2nd, 2008
0

Re: Mail() returning parse error

It works now. Thank you soo much!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Maverick2608 is offline Offline
5 posts
since Oct 2008
Oct 2nd, 2008
0

Re: Mail() returning parse error

It works now. Thank you soo much!
Not a problem.
Reputation Points: 358
Solved Threads: 89
Posting Shark
R0bb0b is offline Offline
986 posts
since Jun 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Problems with my Login
Next Thread in PHP Forum Timeline: <<PHP Parse Error>> Please help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC