1,105,169 Community Members

Php Mail Problem

Member Avatar
RazorRamon
Junior Poster in Training
79 posts since Sep 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I'm having trouble with this php mail code. I'm not sure if I altered it on accident with I copied and pasted it from other sites i've worked on. It send the email however its blank, it only shows:

Name:
Phone:
Email:
Description:


HTML code

<DIV style="    background-image: url(background.png);position: absolute; top:555px; left:40px; width:260px; height:320px;  border: 2px black solid; color:white;"> 
             <form method="post" action="php/thanks.php"> <br><br><br>

              <b>Name:</b><br> <input name="nombre" type="text" STYLE="background: white; border: 2px black solid;"><br > 
              <b>Phone:</b><br><input name="phone" type="text" STYLE="background: white; border: 2px black solid;"><br > 
              <b>Email:</b> <br><input name="email" type="text" STYLE="background: white; border: 2px black solid;"><br > 
              <b>Message:</b><br > 
              <textarea name="comments" rows="4" cols="27" STYLE="background: white; border: 2px black solid;"></textarea><br > 
              <input type="submit" value="send"> 
</div>

PHP php/thanks.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<body>

<?php 
$name = $_post['nombre'];
$phone = $_post['phone'];
$email = $_post['email'];
$comments = $_post['comments'];
$msg .= "            Name:  ".$name."\n";
$msg .= "           Phone:  ".$phone."\n";
$msg .= "           Email:   ".$email."\n";
$msg .= "        Description:  

". $comments."\n";
$recipient = "email@address.com";
$subject = "New Lead";
mail($recipient, $subject, $msg);
?> 

<font size="7">Thank You</font>

</body>

</html>
Member Avatar
madCoder
Junior Poster
165 posts since Feb 2010
Reputation Points: 17 [?]
Q&As Helped to Solve: 45 [?]
Skill Endorsements: 0 [?]
 
0
 

$_post should be $_POST.

er...unless there is another, preceding script that is creating $_post as a filtered, cleaned up version of $_POST. If not, you should filter the form info to prevent potential massive spam abuse.

Member Avatar
RazorRamon
Junior Poster in Training
79 posts since Sep 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

filter the HTML or the PHP? I'm sorry not too sure what you mean or how to do that.

Member Avatar
RazorRamon
Junior Poster in Training
79 posts since Sep 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I tried what you suggested and put it in caps... same problem

Member Avatar
madCoder
Junior Poster
165 posts since Feb 2010
Reputation Points: 17 [?]
Q&As Helped to Solve: 45 [?]
Skill Endorsements: 0 [?]
 
0
 

Add error_reporting(E_ALL); to the top of your thanks.php script. See if any warnings, notices, errors come up.

Member Avatar
Javvy
Junior Poster
150 posts since Feb 2011
Reputation Points: -1 [?]
Q&As Helped to Solve: 32 [?]
Skill Endorsements: 2 [?]
 
0
 

apart from $_POST which madCoder, it looks perfectly fine.

Is your PHP installation configured to send mail?

Member Avatar
sharathg.satya
Posting Whiz in Training
265 posts since Oct 2010
Reputation Points: -10 [?]
Q&As Helped to Solve: 5 [?]
Skill Endorsements: 0 [?]
 
0
 

How to make this?
i am using wamp server
PHP installation configured to send mail
i know that we have to set the php.ini file but i am not getting how to set it
please help me

Member Avatar
asimshahiddIT
Newbie Poster
7 posts since Jun 2010
Reputation Points: 0 [?]
Q&As Helped to Solve: 1 [?]
Skill Endorsements: 0 [?]
 
0
 

For setting mail setting in your wamp server

First you should have existence of company mail server otherwise you can use google mail server.

For Company server

search 'mail function' in your php.ini file

make the following changes..

[mail function]
; For Win32 only.
SMTP = mail.[company_name].com
smtp_port = 25

; For Win32 only.
sendmail_from = [sender mail id]

For google mail server setting

http://www.drupalwizardry.com/content/how-setup-wamp-send-emails-over-gmail-smtp

Member Avatar
sharathg.satya
Posting Whiz in Training
265 posts since Oct 2010
Reputation Points: -10 [?]
Q&As Helped to Solve: 5 [?]
Skill Endorsements: 0 [?]
 
0
 

thanks for the reply
hey what's this company mail server??

Member Avatar
Javvy
Junior Poster
150 posts since Feb 2011
Reputation Points: -1 [?]
Q&As Helped to Solve: 32 [?]
Skill Endorsements: 2 [?]
 
0
 

if you are using localhost,

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

Member Avatar
sharathg.satya
Posting Whiz in Training
265 posts since Oct 2010
Reputation Points: -10 [?]
Q&As Helped to Solve: 5 [?]
Skill Endorsements: 0 [?]
 
0
 

k
thanks

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: