How to send form data to email id by using PHP

Hi,

We are using the yahoowebHostiing service for my company website, In
that one screen of the SendComments/FeedBack section is there, I'm
basically dot.net develeoper ,but yahoowebhosting not
support .asp,.aspx files, it supports PHP files,

I'm searching in JavaScript ,but not found any matter,
I'don't Know PHP.I'm having lot of pressure of higer officials.Please
help me on this.
Please give the Details of the PHP to send form data to given mail id
Name,email,phoneNo, Commnets...........thease are the fileds and by
click send it would be come to given to address mail id,
and how to run the php code, Please send the PHPCODE and Procee,I will
put it on the server

thanks
Malli mindwave [ Fr, 22 Juni 2007 15:00 ] [ ID #1745846 ]

Re: How to send form data to email id by using PHP

Malli mindwave wrote:
> Hi,
>
> We are using the yahoowebHostiing service for my company website, In
> that one screen of the SendComments/FeedBack section is there, I'm
> basically dot.net develeoper ,but yahoowebhosting not
> support .asp,.aspx files, it supports PHP files,
>
> I'm searching in JavaScript ,but not found any matter,
> I'don't Know PHP.I'm having lot of pressure of higer officials.Please
> help me on this.
> Please give the Details of the PHP to send form data to given mail id
> Name,email,phoneNo, Commnets...........thease are the fileds and by
> click send it would be come to given to address mail id,
> and how to run the php code, Please send the PHPCODE and Procee,I will
> put it on the server

If your webhost allows the usage of mail(), it's quite simple

---- form.html ----
<html><head><title>Form Page</title></head><body>
<form action="send.php">
Email:<input text="e-mail"><br>
Short message:<input text="msg"><br>
</form>
</body></html>
---- eof ----


---- send.php ----
<?PHP
//As we are lazy, we don't want to set a from address on the mail, as
//it's the place where spammers can inject extra headers and that way send
//spam to the whole world, so we put everything into the message body
$messagebody=<<<EOF
Senders e-mail address: {$_POST['e-mail']}
The message sent to us: {$_POST['msg']}
EOF;

//we set the headers to null as we don't want to add any
$messageheaders=null;

//Here we send the mail to youraddress [at] exmple.net
//We hardcode the address here, or else spammers could
//select to send the mail to anyone else than you
mail('youraddress [at] exmple.net','Form mail subject',$messagebody,$messageheaders);
?>
<html><head><title>Form Page</title></head><body>
Thanks for your feedback
</body></html>
---- eof ----


You have www.php.net with the online manual with tons of useful user comments
to get the information you need. Just remember to not trust data that is
posted to a mail form, as there are too many US spammers who will take
advantage of any sloopy coding you have made, no matter if you use PHP, Perl
or even basic.

--

//Aho
Shion [ Fr, 22 Juni 2007 16:27 ] [ ID #1745848 ]
PHP » alt.php » How to send form data to email id by using PHP

Vorheriges Thema: Teknologiaplaneetta - Enterprise Solution
Nächstes Thema: PHP 4 security File Access Issue on AIX