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 2974
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 ?
sorry. its php 4.2.3.
i will contact the web host provider.
this code works for you. right?
yes.. why? it isn't working for you?
yes. its not working for me. i developed the script using php version 5.3.
i also tried in 4.2.3 version.
in both versions the mail function is not working. the web host provider provides php 4.2.3 version only.
i get this error
Warning: Failed to connect to mailserver, verify your "SMTP" setting in php.ini in E:\Program Files\Ensim\WEBppliance\SiteData\Domains\outsource projectstoindia.com\ROOT\Inetpub\wwwroot\mail.php on line 11
Mail Not Sent.
That seems to be an error of php.ini, which can only be corrected by the hosting company. I suggest you contact them again and report that error.
for smtp authentication php mail(), i have write a different script?
simple mail() doesnt work for smtp authentication mail()?
the simple mail() and smtp authenticated mail() both have different codes?! or are they same?
You're supposed to be able to send emails from the hosting provider's server, you don't need smtp authentication as far as I know..
what did the hosting company said??
they are saying, we need an smtp authentication to send mail...
Well, I and all the other people can send mails using just the mail() function so the problem is really of your hosting provider.
If you can, I strongly recommend you change to another hosting provider (One who has php latest version for a start).
kovik 1,044
Recognized Expert Top Contributor
Any host that forces you to use an external SMTP authentication to send e-mails isn't a host meant for developers. Hosts that distrust their clients aren't the kind that I'd be comfortable being a client of, since they've probably had issues on their servers before.
I'd find a developer-friendly host.
the hosts having some problem with php and they ask me to change the code in asp. i changed the mail script into asp and now its working...
thanks for your help...
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...
|
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...
|
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...
|
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...
|
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:...
|
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...
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
| |
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...
| |