473,796 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i need help with my mail script

dear all,

i have started learning php 2 weeks ago and i have wrote my first
script for mail sender and the script takes all my data and move to
the thanks page but the problem is that the mails never comes, so i
need your help with me, and here is my script:

mail.htm code:

<form method="POST" action="mail.ph p" onSubmit="">
<p>email <input type="text" name="email" size="20"></p>
<p>subject <input type="text" name="subject"> </p>
<p>message<text area rows="2" name="message" cols="20"></textarea></
p>
<p><input type="submit" value="Submit" name="B1"><inpu t type="reset"
value="Reset" name="B2"></p>
</form>
mail.php code:

<?php
$email = $HTTP_POST_VARS['email'];
$subject = $HTTP_POST_VARS['subject'];
$msg = $HTTP_POST_VARS['message'];
$from = "s7els7.com ";
if (mail($email,$s ubject,$message ,$from)) {
echo "<h4>Thank you for sending email</h4>";
} else {
echo "<h4>Can't send email to $mail</h4>";
}
?>
now please tell me whats wrong with this scripts as i am still trying
to learn the php and i need an expert help.
you can check my script working at www.s7els7.com/mail.htm

thanks

shror

Feb 19 '07 #1
4 1964
"shror" <sh******@gmail .comwrote in news:1171898875 .188006.234860
@p10g2000cwp.go oglegroups.com:
dear all,

i have started learning php 2 weeks ago and i have wrote my first
script for mail sender and the script takes all my data and move to
the thanks page but the problem is that the mails never comes, so i
need your help with me, and here is my script:

mail.htm code:

<form method="POST" action="mail.ph p" onSubmit="">
You don't need the onSubmit attribute if there is nothing to do
<p>email <input type="text" name="email" size="20"></p>
<p>subject <input type="text" name="subject"> </p>
<p>message<text area rows="2" name="message" cols="20"></textarea></
p>
<p><input type="submit" value="Submit" name="B1"><inpu t type="reset"
value="Reset" name="B2"></p>
</form>
mail.php code:

<?php
$email = $HTTP_POST_VARS['email'];
$subject = $HTTP_POST_VARS['subject'];
$msg = $HTTP_POST_VARS['message'];
You want to use the $_POST superglobal array here not the old
$HTTP_POST_VARS array.

$email = $_POST['email'];
$subject = $_POST['subject'];
$msg = $_POST['message'];

$from = "s7els7.com ";
The "From" header needs to be formated correctly:
"From: va***@emai.addr ess.here";

$from = "From: yo************* @s7els7.com";
if (mail($email,$s ubject,$message ,$from)) {
echo "<h4>Thank you for sending email</h4>";
} else {
echo "<h4>Can't send email to $mail</h4>";
}
?>
Leaving your script like this, you are opening yourself up to spammers
finding your form and using it to do all sorts of spamming.

You should read this
<http://www.nyphp.org/phundamentals/email_header_in jection.phparti cle
on preventing Email Header Injection Exploits.

Ken
Feb 19 '07 #2
Hi Ken,
First of all i'd like to thank you so much for offering me help

then about the onsubmit i have removed it now

and in the mail.php page i have made some changes as you told me
the new code is:

<?php
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$from = "From: em***@s7els7.co m";
$t = "shahirwm";
$o = "@gmail.com ";
$to = $t . $o;
if (mail($email,$s ubject,$message ,$from,$to)) {
echo "<h4>Thank you $email for sending $to this email</h4>";
} else {
echo "<h4>Can't send email to $email</h4>";
}
?>
i have made the $from as you said and almost every thing but still i
cant get any mails from this script so please help me once more how to
fix it and where is my problem.
thanks once more for your help
the form URL is: www.s7els7.com/mail.htm

Feb 19 '07 #3
I think there is a mistake in your arguments. From the manual, the
order is:

bool mail ( string $to, string $subject, string $message [, string
$additional_hea ders [, string $additional_par ameters]] )

Why do you pass $email as your first argument and $to as your last
argument? I suggest trying mail($to,$subje ct,$message,$fr om) first.

Another thing to check is your PHP mail configuration, if you are
running your own server. The details are in the PHP manual:
http://www.php.net/manual/en/ref.mail.php. But this applies if you are
running PHP off your own computer.

On Feb 20, 7:11 am, "shror" <shahi...@gmail .comwrote:
Hi Ken,
First of all i'd like to thank you so much for offering me help

then about the onsubmit i have removed it now

and in the mail.php page i have made some changes as you told me
the new code is:

<?php
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$from = "From: e...@s7els7.com ";
$t = "shahirwm";
$o = "@gmail.com ";
$to = $t . $o;
if (mail($email,$s ubject,$message ,$from,$to)) {
echo "<h4>Thank you $email for sending $to this email</h4>";} else {

echo "<h4>Can't send email to $email</h4>";}

?>

i have made the $from as you said and almost every thing but still i
cant get any mails from this script so please help me once more how to
fix it and where is my problem.

thanks once more for your help
the form URL is:www.s7els7.com/mail.htm

Feb 20 '07 #4
On Feb 20, 6:11 am, "Klarth" <kah....@gmail. comwrote:
I think there is a mistake in your arguments. From the manual, the
order is:

bool mail ( string $to, string $subject, string $message [, string
$additional_hea ders [, string $additional_par ameters]] )

Why do you pass $email as your first argument and $to as your last
argument? I suggest trying mail($to,$subje ct,$message,$fr om) first.

Another thing to check is your PHP mail configuration, if you are
running your own server. The details are in the PHP manual:http://www.php.net/manual/en/ref.mail.php. But this applies if you are
running PHP off your own computer.

On Feb 20, 7:11 am, "shror" <shahi...@gmail .comwrote:
Hi Ken,
First of all i'd like to thank you so much for offering me help
then about the onsubmit i have removed it now
and in the mail.php page i have made some changes as you told me
the new code is:
<?php
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
$from = "From: e...@s7els7.com ";
$t = "shahirwm";
$o = "@gmail.com ";
$to = $t . $o;
if (mail($email,$s ubject,$message ,$from,$to)) {
echo "<h4>Thank you $email for sending $to this email</h4>";} else {
echo "<h4>Can't send email to $email</h4>";}
?>
i have made the $from as you said and almost every thing but still i
cant get any mails from this script so please help me once more how to
fix it and where is my problem.
thanks once more for your help
the form URL is:www.s7els7.com/mail.htm- Hide quoted text -

- Show quoted text -
Thank you Klarth for your note, it was correct and it fixed my form,
now its working fine, but i just need one more thing which is how i
set the X-mailer to be someting i do configer, is it possible or not
thanks so much for your help once more and for the help of every body.

shror

Feb 21 '07 #5

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

Similar topics

2
2020
by: DonLi | last post by:
Hello, I tested a PHP script with a FORM of 2 element and it delivered the mail but then when I added more FORM elements, it failed to deliver. Following is the content of the PHP script that I'm talking about, it is my first PHP script. Please advise what's wrong. The mail server, kind of unlikely, the first try it sent the mail (beginner's luck?), all of sudden, it went down? it's not on my box. Thanks.
9
1901
by: Jofio | last post by:
I am just learning PHP. I just tried coding a php script which I saved as mail.php ---------------------------- <? $name=$_POST; $email=$_POST; $comments=$_POST;
0
9876
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ********************************** package Celcom.Client;
5
3884
by: Bernard | last post by:
Hi, I have a problem with a CGI script (Perl) on a Win2000 server. The script is for sending E-cards and was written by Jason Maloney: http://www.aestheticsurgerycenter.com/scripts/postcard/postcard1.shtml You can choose from some cards, add your own text and send it to a friend. This friend get a mail which tell him/her that he/she has a mail and have to click a link. So far everything works just fine. But when the recipient clicks...
2
9243
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends - I see hebrew, it is just sending by myself using *.aspx scripts). In web.config I have the following : <configuration> <system.web>
20
1745
by: Pete Marsh | last post by:
Wondering if anyone can see an error with this script. I get a server configuration error. THat could mean a module is not being loaded, but maybe there's a syntax error here, can anyone spot it? Thanks <? Error_Reporting(E_ALL & ~E_NOTICE); $subject="from ".$_REQUEST ; $headers= "From: ".$_REQUEST ."\n"; $headers.='Content-type: text/html; charset=iso-8859-1';
0
1384
by: josh | last post by:
HI I'm new to .asp and vbscript and I need to validate a form before it is emailed to me. I don't really understand what email functionality I have on the server (and the tech support might get back to me in about 10 years). Right now all the current forms are e- mailed using a method="post" action="http://www.website.com/cgi-bin/ mail?user@website.com", but I do not have any access to the script that is e-mailing the form data. What I...
11
1795
by: shror | last post by:
Hi every body, Please I need your help solving my php mail() function problem that the code is appearing in the view source and I dont know whats the problem where I am using another page tto test the php and its executed very nice The page have php code viewed : http://beachtoursegypt.com/booking-form.htm where after submitting the form the data are sent to the confirmation age where the php script lies there and its not executed
5
2307
by: simononestop | last post by:
Hi im totally new to perl this is my first go at using it (I normally use asp). I have set up a form with a cgi script from demon hosting. I have edited the script and the form works it sends me an email. however all the information is missing form the email I only get the first form text field?? #!/bin/perl # ------------------------------------------------------------
0
9679
marktang
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...
0
9527
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
10453
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
10003
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...
1
7546
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
6785
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
5441
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...
1
4115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2924
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.