users fill the feedback form and send mails to us.
i wnat to ue php mail() function. plz help how to use the php script? what are the things i need for that?
i am new to this plz help...
25 2987
It's very simple actually. - <?php
-
$to = 'feedback@yoursite.com';
-
$subject = 'the subject';
-
$message = 'User Message';
-
$headers = 'From: $userEmail';
-
-
mail($to, $subject, $message, $headers);
-
?>
-
I suppose you know how how to get the $message, the $userEmail and possibly the $subject from the feedback html form. If not just say so.
simply i can upload the php script to my website?
i want to know other than the html form and php script what else i need?
i upload both the form and script to my website. but the mail is not reciving...
this is my contact form -
<form id="contacts-form" method="post" action="mail.php" onSubmit="return validateForm(this)">
-
<fieldset>
-
<div class="field"><label>Full Name:</label><input type="text" value="" name="name"/> <font color="#FF0000" size="+1">*</font></div>
-
<div class="field"><label>E-mail:</label><input type="text" value="" name="email"/> <font color="#FF0000" size="+1">*</font></div>
-
<div class="field"><label>Phone:</label><input type="text" value="" name="phone"/> <font color="#FF0000" size="+1"></font></div>
-
<div class="field"><label>Subject:</label><input type="text" value="" name="subject"/></font></div>
-
-
<div class="field"><label>Services:</label><select name="services">
-
<option>------------Select------------</option>
-
<option>Call Center Services</option>
-
<option>Data Entry Services</option>
-
<option>KPO Services</option>
-
<option>Health Care Services</option>
-
<option>Software Development</option>
-
</select>
-
<font color="#FF0000" size="+1">*</font>
-
</div>
-
<div class="field"><label>Message:</label><textarea name="message" cols="" rows=""></textarea> </div>
-
-
<div align="center"><input type="submit" value="SUBMIT"/></font></div>
-
-
<!--<div class="alignright"><a href="mail.php" class="button" onclick="document.getElementById('contacts-form').submit()"><em><b>Submit</b></em></a>
-
</div>-->
-
</fieldset>
-
</form>
-
this is my mail.php script -
<?php
-
//if(isset($_POST['email'])) {
-
-
-
$email_to = "impin@in.com"; //mail id
-
$email_subject = "Outsource Projects to India";
-
-
-
$name = $_POST['name'];
-
$email = $_POST['email'];
-
$phone = $_POST['phone'];
-
$services = $_POST['services'];
-
$message = $_POST['message'];
-
-
-
-
-
$email_message = "Form details below.\n\n";
-
-
function clean_string($string) {
-
$bad = array("content-type","bcc:","to:","cc:","href");
-
return str_replace($bad,"",$string);
-
}
-
-
$email_message .= "Name: ".clean_string($name)."\n";
-
$email_message .= "Email: ".clean_string($email)."\n";
-
$email_message .= "Phone: ".clean_string($phone)."\n";
-
$email_message .= "Services: ".clean_string($services)."\n";
-
$email_message .= "Message: ".clean_string($message)."\n";
-
-
-
// create email headers
-
$headers = 'From: '.$email."\r\n".
-
'Reply-To: '.$email."\r\n" .
-
'X-Mailer: PHP/' . phpversion();
-
ini_set("sendmail_from","impin@in.com");
-
mail($email_to, $email_subject, $email_message, $headers);
-
?>
-
is anything wrong in the code? or what else the problem?
now my website is online. but the mails only not going... -
if (mail($email_to, $email_subject, $email_message, $headers))
-
{
-
echo "<h4>Thank you for sending email</h4>";
-
} else {
-
echo "<h4>Can't send email</h4>";
-
}
-
?>
-
i get result as "cant send email".
so what i do?
Well before anything let's make sure you realize that you have this on your code: - //if(isset($_POST['email'])) {
Was that a mistake or what? If that line is commented if means it will never be executed. And so your script will never run.
even if this line is executed, still i wont get mail.
still i get the result as i cant send mail... -
if(isset($_POST['email'])) {
-
in this code 'email' is what? it is email.php?! or its a keyword? in myacse my php file is mail.php.
so i have to change the code like this? -
if(isset($_POST['mail'])) {
-
or i can use the same code -
if(isset($_POST['email'])) {
-
plz help
- if(isset($_POST['email'])) {
That 'email' comes from the form, the field with name='email'.
You use that to to tell the script to run only if the form as been submitted. Normally you'd use $_POST['submit'] but you can use any other form field.
Not sure exactly what the problem was (probably that if in the beginning) but the code now works. -
<?php
-
if(isset($_POST['email'])) {
-
-
-
$email_to = "impin@in.com"; //mail id
-
$email_subject = "Outsource Projects to India";
-
-
-
$name = $_POST['name'];
-
$email = $_POST['email'];
-
$phone = $_POST['phone'];
-
$services = $_POST['services'];
-
$message = $_POST['message'];
-
-
-
-
-
$email_message = "Form details below.\n\n";
-
-
function clean_string($string) {
-
$bad = array("content-type","bcc:","to:","cc:","href");
-
return str_replace($bad,"",$string);
-
}
-
-
$email_message .= "Name: ".clean_string($name)."\n";
-
$email_message .= "Email: ".clean_string($email)."\n";
-
$email_message .= "Phone: ".clean_string($phone)."\n";
-
$email_message .= "Services: ".clean_string($services)."\n";
-
$email_message .= "Message: ".clean_string($message)."\n";
-
-
-
// create email headers
-
$headers = 'From: '.$email."\r\n".
-
'Reply-To: '.$email."\r\n" .
-
'X-Mailer: PHP/' . phpversion();
-
ini_set("sendmail_from","impin@in.com");
-
-
if (mail($email_to, $email_subject, $email_message, $headers))
-
{
-
echo "<h4>Thank you for sending email</h4>";
-
} else {
-
echo "<h4>Can't send email</h4>";
-
}
-
-
}
-
else {
-
-
echo "<h3>Error</h3>";
-
}
-
?>
-
Emails coming from mail() scripts usually go to spam folder, be sure to check it if you're not receiving emails.
really this code works for you?!
for me still not working..
still i get result cant send mail...
my web host provider provides
php 4.3.2 only
Oh.. I'm not sure if php 4.3.2 supports mail()..
Can't you get another provider that has php 5 ?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Andrew |
last post by:
Where can i find a free feedback form in php script to download it and
put it in my website?
thanks in advance
andreas
|
by: Mindful_Spirit |
last post by:
I'm trying to set up a basic email feed back form
like
this, and was wondering about some basic configuration settings. I
have used code from
this
website. I have it working just fine. I'm running IIS on my home
machine.
My problem is that I need to upload this stuff to a webhosting place and
register a domain and I'm not sure what to put as the smtp mail server value
|
by: Andrew |
last post by:
Where can i find a free feedback form in javascript to download it and
put it in my website?
thanks in advance
andreas
|
by: Zagor |
last post by:
I have a feedback form in my website with three TextBoxes and a SEND button
in a user control.
Below is a piece of the code:
//On click event for the send LinkButton
private void SendClicked(object sender, EventArgs e){
try{
if (Page.IsValid){
|
by: anj |
last post by:
Hi:- how to create contact us,feedback form in asp.net.Plz help.
| |
by: ak |
last post by:
Hi Guys,
I have few questions on mobilizing existing website.
One of our client has an ecommerce website that shows product
catalogue and if you are logged in , shopping cart. It is developed
using jsp technologies.
What we were asked is to enable the website in a blackberry device
(e.g. small browser).
|
by: m.schaeffer |
last post by:
Hello,
my problem is, that if i create a new website with Visual Studio 2005
and I choose "AJAX enabled Website" everything works fine.
But if I try to do the same with an existing Website (AJAX Extesions
where installed later) the "AJAX"-functionality fails.
Though I have the AJAX Extensions in my Tool-Box and everything seems
ok it doesn`t work. I can drag and drop ScriptManager, UpdatePanels,
ContentTemplates ... but when I run the...
|
by: nickyspace |
last post by:
i have a code wherein it is asking email id and message from the user in the form named as feedback.html
HTML CODE AS BELOW<html>
<body>
<form method="post" action="sendmail.php">
Email: <input name="email" type="text" size="20" /><br />
Message:<br />
<textarea name="message" rows="15" cols="40">
</textarea><br />
<input type="submit" />
</form>
|
by: max2008mmm |
last post by:
I am trying to create a email contact form for our website. I want there to be four fields for a visitor to fill in (name, email address, subject, message). The subject field will be a drop-down box to allow for a variety of purposes for the visitor's message. I know how to do all of this and have the message sent to one address. However, I would like to associate each subject choice to a different email address. I've looked all over the...
|
by: gnawz |
last post by:
I have a feedback form code which does email but does not display the correct content.
In place of the email address, it displays "+1"
And the body message is "1"
It works well when I test it on localhost.
As in
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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...
|
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...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |