473,486 Members | 2,353 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

PHP mail function problems

97 New Member
Hi Im new to this mail function. I have an html page with textboxes, comboboxes and textarea...i'ved named them all and created this php sendmail.php file to send all the data. The only thing is when i click on submit I get this error:
Expand|Select|Wrap|Line Numbers
  1. Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\sendmail.php on line 12
My php code is this:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3.   $Companies = $_REQUEST['Companies'] ;
  4.   $FirstName = $_REQUEST['FirstName'] ;
  5.   $LastName = $_REQUEST['LastName'] ;
  6.   $District = $_REQUEST['District'] ;
  7.   $email = $_REQUEST['email'] ;
  8.   $phone = $_REQUEST['phone'] ;
  9.   $Issues = $_REQUEST['Issues'] ;
  10.   $message = $_REQUEST['message']
  11.  
  12.   mail( "gmedrano@bowen.bz", "Feedback Form Results",
  13.     "$Companies\n $message\n",
  14.      "From: $FirstName <$email>" );
  15.   header( "Location: http://localhost/itsuccess.html" );
  16. ?> 
Im not sure if that is how u set up the data...i'ved searched some tutorials and it just shows the $email and $message variables. All the names are correct, my php.ini settings are as follows:
Expand|Select|Wrap|Line Numbers
  1. SMTP = localhost
  2. smtp_port = 25
with the other settings not active.

I'll appreciate any input on this matter...
Apr 22 '08 #1
8 2013
nomad
664 Recognized Expert Contributor
Hi Im new to this mail function. I have an html page with textboxes, comboboxes and textarea...i'ved named them all and created this php sendmail.php file to send all the data. The only thing is when i click on submit I get this error:
Expand|Select|Wrap|Line Numbers
  1. Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\sendmail.php on line 12
My php code is this:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $Companies = $_REQUEST['Companies'] ;
  4. $FirstName = $_REQUEST['FirstName'] ;
  5. $LastName = $_REQUEST['LastName'] ;
  6. $District = $_REQUEST['District'] ;
  7. $email = $_REQUEST['email'] ;
  8. $phone = $_REQUEST['phone'] ;
  9. $Issues = $_REQUEST['Issues'] ;
  10. $message = $_REQUEST['message']
  11.  
  12. mail( "gmedrano@bowen.bz", "Feedback Form Results",
  13. "$Companies\n $message\n",
  14.      "From: $FirstName <$email>" );
  15. header( "Location: http://localhost/itsuccess.html" );
  16. ?> 
Im not sure if that is how u set up the data...i'ved searched some tutorials and it just shows the $email and $message variables. All the names are correct, my php.ini settings are as follows:
Expand|Select|Wrap|Line Numbers
  1. SMTP = localhost
  2. smtp_port = 25
with the other settings not active.

I'll appreciate any input on this matter...
Hello gggram2000
On line 12 is might look like this...
[PHP]
$EmailTo = "gmedrano@bowen.bz;
[/PHP]
if you want "Feedback Form Results" you could do this
[PHP]$EmailFrom = "Feedback Form Results";[/PHP]

hope that help you...

nomad
Apr 22 '08 #2
ronverdonk
4,258 Recognized Expert Specialist
Why not terminate line 10[php]$message = $_REQUEST['message']
[/php]with a semi-column?

Ronald
Apr 22 '08 #3
TheServant
1,168 Recognized Expert Top Contributor
Why not terminate line 10[php]$message = $_REQUEST['message']
[/php]with a semi-column?

Ronald
Yeah, that would be the problem.
Apr 22 '08 #4
gggram2000
97 New Member
Yea thanks I was missing that...Now I get this error:
Expand|Select|Wrap|Line Numbers
  1. Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\sendmail.php on line 15
  2.  
  3. Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\sendmail.php:15) in C:\xampp\htdocs\sendmail.php on line 16
  4.  
The SMPT and SMTP port are set properly...I'ved done all sort of changes and it still gives me the same error...Any suggestions?
Apr 22 '08 #5
ronverdonk
4,258 Recognized Expert Specialist
Firstly: the second error is only issued because of the display of the first error.

I do not think you have configured your setting correctly in php.ini. You specify
Expand|Select|Wrap|Line Numbers
  1. SMTP=localhost
but have you really installed an SMTP server on your localhost? If not, then specify a smtp server (e.g. the one of your ISP).

Ronald
Apr 24 '08 #6
gggram2000
97 New Member
Firstly: the second error is only issued because of the display of the first error.

I do not think you have configured your setting correctly in php.ini. You specify
Expand|Select|Wrap|Line Numbers
  1. SMTP=localhost
but have you really installed an SMTP server on your localhost? If not, then specify a smtp server (e.g. the one of your ISP).

Ronald
Thanks, I realized I had four php.ini files and it seems that it was picking up the one in XAMPP and not the one on windows. Also you were right about the localhost, I specified the smtp server and it worked great.

Cheers!
May 6 '08 #7
ronverdonk
4,258 Recognized Expert Specialist
Glad it is solved. See you around.

Ronald
May 6 '08 #8
badvoc
44 New Member
Hi

Just thought I say thanks as this has helped me. I had my sales email address in the mail header and found some emails have been going in to spam boxes and therefore missed. I now have the comany name in from field.

Always the first port of call for help and never failed me yet!!!

Thanks again.
May 14 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4070
by: James M. Luongo | last post by:
Hello, I am having problems with the mail() function, but I don't know what the problems are. Here is a snippet of code: $to = "jmluongo@comcast.net"; $from = "Gallery@gafok.com";...
3
5032
by: Markus Weber | last post by:
Hi, we use htmlMimeMail-2.5.1 (http://www.phpguru.org/mime.mail.html) to send mails. If I send an e-mail with the subject "Das Öl - Öl Öl - Ö Ä Ü ß - test test" I will receive an e-mail with...
8
52080
by: Pierre Jelenc | last post by:
I use mail() for a musician's mailing list script that suddenly started having problems after many months of working flawlessly. The code fragment is: if...
5
1713
by: Jack Smash | last post by:
I am having lots of trouble with the mail function! I simply send a confirmation email to someone who has registered on my site - but thte message usually gets filtered or sent to the bulk mail...
4
1829
by: Geoff Soper | last post by:
I'm using the mail() function to send e-mails. The first argument to the function is the e-mail address the mail will be sent to. I understand this should just be in the format 'address@domain' and...
7
2602
by: Jim Seymour | last post by:
I have a contact form that uses PHP's mail() function. It recently came to my attention that (some?) MS-Windows mail servers may not properly process data given to the mail() function that's only...
4
4805
by: Data Goob | last post by:
This one has me stumped. How did SuSE disable the mail() function in their RPM'd version of PHP? ( This is their install-version of PHP with RPMs not what you download from PHP.net ) I have...
8
5448
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
1
3096
by: mayanksrmcem | last post by:
I need ur help. I want to send emails through php code. but there are some problems n i'm not able to understand the actual problems. the code , i've used is as followes---- <?php if...
5
3929
by: Dave | last post by:
Hi All, I'm experiencing problems with sending mail using mail() to forwarded email accounts. The problem seems to revolve around the optional 4th argument of mail(), namely 'additional headers'....
0
7105
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7180
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7341
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4564
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.