Jump to content

Mailer.php Question


CTI

Recommended Posts

This is my form:

<form name="form1" method="post" action="[b]mailer.php[/b]" onsubmit="return formCheck(this);" >
<table width="303" border="0" cellspacing="10" cellpadding="0">
<tr>
<td width="283">Name:
<input name="Name" type="text" id="Name" size="35"></td>
</tr>
<tr>
<td>Email:
<input name="Email" type="text" id="Email" size="35"></td>
</tr>
<tr>
<td><div align="center">
<input name="Reset" type="reset" id="Reset" value="Reset">
<input type="submit" name="Submit" value="Submit">
</div></td>
</tr>
</table>
</form>

and this is how I set up my mailer.php, if you need the whole thing, just let me know:


$to = "[b]email@gmail.com[/b]"; #this is the email i set up, but i still have not received the email...
$subject = "Member"; #set the subject line
$headers = "Soon to be Member"; #set the from address, or any other headers
$forward = 0; # redirect? 1 : yes || 0 : no
$location = "thanks.html"; #set page to redirect to, if 1 is above

does anyone know why I do not get the email when I fill out the form and hit submit?

thanks
Link to comment
Share on other sites

[!--quoteo(post=364282:date=Apr 13 2006, 12:09 AM:name=CTI)--][div class=\'quotetop\']QUOTE(CTI @ Apr 13 2006, 12:09 AM) [snapback]364282[/snapback][/div][div class=\'quotemain\'][!--quotec--]
This is my form:

<form name="form1" method="post" action="[b]mailer.php[/b]" onsubmit="return formCheck(this);" >
<table width="303" border="0" cellspacing="10" cellpadding="0">
<tr>
<td width="283">Name:
<input name="Name" type="text" id="Name" size="35"></td>
</tr>
<tr>
<td>Email:
<input name="Email" type="text" id="Email" size="35"></td>
</tr>
<tr>
<td><div align="center">
<input name="Reset" type="reset" id="Reset" value="Reset">
<input type="submit" name="Submit" value="Submit">
</div></td>
</tr>
</table>
</form>

and this is how I set up my mailer.php, if you need the whole thing, just let me know:
$to = "[b]email@gmail.com[/b]"; #this is the email i set up, but i still have not received the email...
$subject = "Member"; #set the subject line
$headers = "Soon to be Member"; #set the from address, or any other headers
$forward = 0; # redirect? 1 : yes || 0 : no
$location = "thanks.html"; #set page to redirect to, if 1 is above

does anyone know why I do not get the email when I fill out the form and hit submit?

thanks
[/quote]


You never called the mail() function.

[a href=\"http://in.php.net/manual/en/function.mail.php\" target=\"_blank\"]http://in.php.net/manual/en/function.mail.php[/a]
Link to comment
Share on other sites

[!--quoteo(post=364299:date=Apr 13 2006, 01:24 AM:name=bonaparte)--][div class=\'quotetop\']QUOTE(bonaparte @ Apr 13 2006, 01:24 AM) [snapback]364299[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You never called the mail() function.

[a href=\"http://in.php.net/manual/en/function.mail.php\" target=\"_blank\"]http://in.php.net/manual/en/function.mail.php[/a]
[/quote]

OK, so basically it's something like this:

<?PHP mail("toaddress", "subject", "message body", "additional_headers"); ?>

but where do I put that,?
Link to comment
Share on other sites

This might not be perfect, but you should get the idea. since you're using the additional headers, I've added a simple spammer hack detector. the mail funciton follows.

mailer.php
[code]
<?
if((strpos($_POST['Name'],"\n",1)) OR (strpos($_POST['Name'],"\r",1)) OR (strpos($_POST['Email'],"\n",1)) OR (strpos($_POST['Email'],"\r",1))) die(); // check for email form hack attempts, if present, do nothing.
mail("email@gmail.com","Subject","Message","From: ".$_POST['Name']." <".$_POST['Email'].">");
// if there were no hack attempts, the following HTML will print.
?>
<html>
<head>
<title>Thank You!</title>
</head>
<body>
Thank you for sending me your information.
</body>
</html>
[/code]
Link to comment
Share on other sites

[!--quoteo(post=364451:date=Apr 13 2006, 10:19 AM:name=michaellunsford)--][div class=\'quotetop\']QUOTE(michaellunsford @ Apr 13 2006, 10:19 AM) [snapback]364451[/snapback][/div][div class=\'quotemain\'][!--quotec--]
This might not be perfect, but you should get the idea. since you're using the additional headers, I've added a simple spammer hack detector. the mail funciton follows.

mailer.php
[code]
<?
if((strpos($_POST['Name'],"\n",1)) OR (strpos($_POST['Name'],"\r",1)) OR (strpos($_POST['Email'],"\n",1)) OR (strpos($_POST['Email'],"\r",1))) die(); // check for email form hack attempts, if present, do nothing.
mail("email@gmail.com","Subject","Message","From: ".$_POST['Name']." <".$_POST['Email'].">");
// if there were no hack attempts, the following HTML will print.
?>
<html>
<head>
<title>Thank You!</title>
</head>
<body>
Thank you for sending me your information.
</body>
</html>
[/code]
[/quote]


Wow thank you very much man. That's awesome! :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.