473,770 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to send form data to email id by using PHP

Hi,

We are using the yahoowebHostiin g 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.Pleas e
help me on this.
Please give the Details of the PHP to send form data to given mail id
Name,email,phon eNo, 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

Jun 22 '07 #1
2 5634
Malli mindwave wrote:
Hi,
Hi,

Welcome here from comp.lang.javas cript.

We are using the yahoowebHostiin g 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,
Wise choice. But not very nice for you.
>
I'm searching in JavaScript ,but not found any matter,
I'don't Know PHP.I'm having lot of pressure of higer officials.Pleas e
help me on this.
Higher officials seldom care about 'details' like learning a new language
from scratch. Why should they? They don't have to implement it themselfs..
;-)
Please give the Details of the PHP to send form data to given mail id
Name,email,phon eNo, 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
Nobody can send you complete code. Too many unknown variables.

But a good place to start:
www.php.net then type mail into the searchbox.

Also look at the mailfunction itself:
http://nl2.php.net/manual/en/function.mail.php

Browse around a little and try to implement some code yourself on your
server.
The usercontributed notes contain a lot of usefull information.

Basicly what you do is this (But PLEASE don't do it like this because all
kind of ugly hackers will use your site to send spam. This is called
header-injection. You don't want that.):

1) Receive the forminformation
2) assemble the email (body, subject, to who? etc)
3) send the email

Suppose your html page has a form with the following elements:
- email
- name
- phonenr
- comments

And when the user clicks submit, you want that those 4 elements are send to
'm************@ mindwave.com'

<?php
// receive the posted formelements, I made up the names myself.
$email = $_POST["email"];
$name = $_POST["name"];
$phonenr = $_POST["phonenr"];
$comments = $_POST["comment"];

// Please note that this input MUST be sanitised before using
// but for the sake of a simple example I don't.

$subject = "Somebody filled in a form";
$sendto = 'm************@ mindwave.com';
$body = "Hi Malli,\nSomebod y filled in a form.\n\n";
$body .= "Passed info:\n";
$body .= "email: $email\n";
$body .= "name: $name\n";
$body .= "phonenr: $phonenr\n";
$body .= "comments: $comments\n";

// Wordwrap the body to max 70 characters a line:
$body = wordwrap($body, 70);

mail($sendto, $subject, $body);

// done

?>

That is basically all.
But be warned, even veteran PHP programmers make mistakes with emailing,
simply because a lot can go wrong.
Like the abovementioned header-injection.
Or wrong headers set according to spamfilters, so your email never arives.
(try sending to hotmail.com if you need a headache)

You might want to use a lib/class to send email.

I use HTMLMimeMail a lot, for sending emails that have both text and HTML
content and/or attachments. (google for it if you want it)

PHP also have the PEAR packages that contain a good mail class.
Very good chances they are allready installed on your system.

Honest warning:
This might be over your head if you don't even know PHP. :-/
If you are on a tight deadline, you might consider hiring a PHP programmer
who did this before to help you out. Setting up a basic emailprogram
shouldn't take more than a day.

Good luck.

Regards,
Erwin Moller

>
thanks
Jun 22 '07 #2
Malli mindwave wrote:
Hi,

We are using the yahoowebHostiin g 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.Pleas e
help me on this.
Please give the Details of the PHP to send form data to given mail id
Name,email,phon eNo, 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
Try googling for PHP and formmail. There are a number of scripts out there.
Jun 22 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3033
by: Kenny | last post by:
I'm trying to retrieve the data off a form (survey.htm) and email the results back to me using CDO and ASP (survey.asp). I'm confused as to how to retrieve the form data from survey.htm and send it using survey.asp. Below is a sample ASP script that I found on ASPFAQ.com and it works fine, but now how do I grab the info from a form and incorporate it into the emal. Thanks. Appreciate any help or guidance. Kenny <%
2
20748
by: Fatih BOY | last post by:
Hi, I want to send a report from a windows application to a web page like 'report.asp' Currently i can send it via post method with a context like local=En&Username=fatih&UserId=45&Firm=none But the problem occures when i want to send a data with & sign (i.e: Firm=F&B). I try to solve this problem with using boundary, but i failed. Any idea!?
4
2419
by: riteshjain82 | last post by:
Hi, Please go through this: I am having a file (default.asp) on which i am taking many details from a user before mailing it to someone. I have also provided the user with a facility of uploading files on a server. I am uploading files from a page upload.asp which has a link on default.asp. Now my problem is that, how can i send the file name that is uploaded, in a mail along with other details that the user enters on default.asp?? In...
0
1672
by: Dave S | last post by:
I have a lot of forms on our web site that require the user to fill out information and submit it back to us. currently the information comes back as name value pair. The our employee's then has to go thru all this code and fill in a template with the data and print the info out. It would be so much easier if we could have a button that would access the file/send/page by email button on IE. Using asp.net 2 the my.computer.keyboard.sendkey...
3
4516
by: YMPN | last post by:
Hi Everyone, I'm deen from Riyadh. Please do help me with some problem i have. I have this formview control setup to recieved inputs from user (textbox, dropdownlist, others). After inserting, I want to send the data via email, the problem is how do I do that?
1
2715
by: steinwaygirl | last post by:
Hi all, I have been searching so hard for the answer to this, hopefully some of you all can help. I have created an HTML file with various forms - also included CSS and some javascript for checkboxes and autofill of Identical forms, as well as pulldown menus. When I fill out a form and (on the IE browser pull down menu) select: File --> Send --> Page by Email, the page goes into MS outlook (as it should) - However, all of the data is...
1
4015
by: Malli mindwave | last post by:
Hi, I want to send form data to given email id, I'm using mailto:ur@mail.com, but it doesn't working it dirsctly goes to localSystem A/C i.e outlook.. <form name="form1" method="post" action="mailto:malli921@gmail.com" enctype="text/plain">
1
3208
by: deepaks85 | last post by:
Dear All, I want to send some data through a form with Multiple attachment in an HTML Format. I have tried it but it is not working for me. I am able to send data without attachment but with the code for attachment, I am not able to send anything. I get blank email. Can you please help me on this? Here is the html form:
1
3442
by: toretto | last post by:
Hello, I have a script php that I use on my website to permit visitors to send me some email with some data, this is the html table code: <table width="730" border="0" cellpadding="0" cellspacing="0"> <tr> <td><div align="center" class="textorange1"><strong>Richiesta Ricarica</strong></div></td> </tr> <tr> <td>&nbsp;</td>
0
9453
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10254
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10099
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8929
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7451
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5481
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2849
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.