Computing.Net > Forums > Web Development > php FormtoEmail

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

php FormtoEmail

Reply to Message Icon

Name: Infamous01
Date: December 23, 2007 at 11:57:01 Pacific
OS: na
CPU/Ram: na
Product: na
Comment:

I have currently setup a php form. Once information is submitted, it should sent it to my email however it is not. Does this usually take a while? The code i used for the form is in this website.

http://formtoemail.com/FormToEmail.txt


There are no errors however its just not sending to my email. Any suggestions? Ive entered my email exactly where it said to.



Sponsored Link
Ads by Google

Response Number 1
Name: allam_rahmeh
Date: February 16, 2008 at 03:47:29 Pacific
Reply:

Dear Infamous01:
Try the code below its working

<?

-------- co--------- //
// Your email to get the results.
$dest = "aaaaa@xxxxxx.cc";

// The sender address
$sender = "aaaaa@xxxxxx.cc";

// Address for undelivered emails
$undelivered = "aaaaa@xxxxxx.cc";

//Full path to your upload dir
$up_full = "http://www.xxxxxx.cc/dddd/";

//Relative path from this script (important)
$up_dir = "./upload/";

// Number of upload fields. Put 0 if you don't want any.
$UploadNum = "3";

//Host mail functions. Possible values are 0,1 or 2. See below:
// 0 is for most hosts (default value).
// 1 is for Online.Net (Online).
// 2 is for Nexenservices.com (Nexen).

$online_isp = "0";


if(isset($_REQUEST["submit"]))
{
ields Verification Pro- //
$Nada = '';
$From = $_REQUEST['From'];
$Msg = $_REQUEST['Msg'];

if(empty($From))
{
$Nada.="Email field is empty

";
}
if(empty($Msg))
{
$Nada.="Message field is empty ";
}
$noway = "$Nada" ;

if(empty($Nada) &&
eregi("^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+\\.[a-z]{2,4}$",$From))
{
$ok = 1;
}
elseif(!empty($Nada) &&
eregi("^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+\\.[a-z]{2,4}$",$From))
{
$ok = false;
}
else
{
$ml = "Your email address is invalid

";
$ok = false;
}
------------------ //

--- Mail Bui------ //
if($ok=="1")
{
$referer = $_SERVER["HTTP_REFERER"];
$sujet = "Feedback";
$body ="Origin: $referer\n";
$body.="\n***** Results *****\n\n";

if(count($_POST))
{
while(list($key, $val) = each($_POST))
{
$body.="$key : $val\n";
}
}

$body.="\n\n";
$body.="Upload: $uploaded\n";
$body.="$all_names\n";
$body.="$get_files\n";
$body.="*************************\n";

if($online_isp == "1")
{
if(!email("feedback",$dest,$sujet,$body))
{
print "An error occured during mail delivery
";
}
}
elseif ($online_isp == "2")
{
include "mail.inc";
if(!email($dest,$sujet,$body))
{
print "An error occured during mail delivery
";
}
}
else{
$headers = $sender;
if(!mail($dest,$sujet,$body, $headers, "-f $undelivered"))
{
print "An error occured during mail delivery
";
}
}
------------------ //

-- Success Mes---- //
?>
<html><head><title>Contact Me</title><meta http-equiv="Content-Type" content="text/html; charset=windows-1256"><style type="text/css">

<table border="0" width="44%" align="center"><tr><td valign="top">
<table border="1" width="70%" bordercolor="#57581E" bordercolordark="#57581E" cols="1" align="center"><tr><td>
<form action="<?echo $_SERVER['PHP_SELF'] ?>" method="post" enctype="multipart/form-data">
<table border="0" bordercolor="#57581E" height="100" align="center"><tr>
<td height="5" width="218">
Email : </td><td height="5" width="249"><input type="text" size="30" maxlength="255" name="From" style="background-color: #ffffff;font: verdana; color: #57581E; border: 0px;" value=""></td></tr><tr><td height="5" width="218">
Name : </td><td height="5" width="249"><input type="text" size="30" name="Name" style="background-color: #ffffff;font: verdana; color: #57581E; border: 0px;" value=""></td></tr></table>
<p align="center">
Message :

<textarea name="Msg" cols="45" rows="7"></textarea>
</p>
<table width="90%" border="0" align="center"><tr align="center"><td> </td>

<input type="reset" name="reset" value=" Clear ">
<input type="submit" name="submit" value=" Send ">
</form>

</td></tr></table>
</td></tr></table>
</body>

</html>
<? } ?>

Allam Rahmeh
Latakia Syria


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: php FormtoEmail

php n00b www.computing.net/answers/webdevel/php-n00b/265.html

PHP - saving a file www.computing.net/answers/webdevel/php-saving-a-file/2142.html

php help: submitting txt fields www.computing.net/answers/webdevel/php-help-submitting-txt-fields/2871.html