-
mail() function
I must have tried at least 10 ways of setting up the headers for this but nothing seems to work.
In my php.ini file, I have SMTP = 137.99.158.180 (my IP) and sendmail_from = [email protected] (some name I made up)
This is the form that I am using:
Code:
<form id="HowToForm" action="sendguide.php" method="post" name="HowToForm">
<table id="FormTable" cellSpacing="2" cellPadding="2" width="700" align="center" border="0">
<tr>
<td align="middle"><font size="4">Your Name: <font color="red" size="5"><b>*</b></font></font><br>
<input id="ConName" type="text" size="50" name="ConName">
</td>
</tr>
<tr>
<td align="middle"><font size="4">Your Email: <font color="red" size="5"><b>*</b></font></font><br>
<input id="ConEmail" type="text" size="50" name="ConEmail" onBlur="this.value=ignoreSpaces(this.value);"><br>
<i>This is to give credit to you for submitting your guide.</i>
</td>
</tr>
<tr>
<td align="middle"><font size="4">URL:</font><br>
<input id="Address" type="text" size="50" name="Address"><br>
<i>This is also to give credit to you for submitting your guide.<br>
<b>[Vendetta] asks that you please <a href="javascript:popUp('linktoV.html')">link to us</a> on your website.</b></i>
</td>
</tr>
<tr>
<td align="middle"><font size="4">Your How-To Guide: <font color="red" size="5"><b>*</b></font></font><br>
<textarea id="Guide" name="Guide" rows="18" cols="80"></textarea><br>
<i>At this time, [Vendetta] does not and will not accept submissions as attachments. Please copy and paste into the box above.</i>
</td>
</tr>
<tr>
<td align="middle"><font size="4">Any additional comments/suggestions?</font><br>
<textarea id="Comments" name="Comments" rows="5" cols="45"></textarea>
</td>
</tr>
<tr>
<td align="middle"><br>
<input type="button" id="SubmitButton" value="Submit" name="cmdSubmit" onclick="verify);"> <input id="ClearButton" type="reset" value="Clear" name="cmdClear">
</td>
</tr>
</table>
</form>
Here's what I try to send:
PHP Code:
<?php
/***************************************
** check to make sure ppl cannot spam **
***************************************/
if($sentemail == "5"){
include("HowTo_fail.html"); //displays page if spamming
}else{
$num = $sentemail + 1;
setcookie("sentemail","$num",time()+600); //set the cookie (expires in 10 minutes)
/*************************************
** send notification email to admin **
*************************************/
$to = "[email protected]";
$mailheaders = "X-Mailer: PHP/" . phpversion();
$mailheaders .= "From: $ConEmail\n";
$subject = "[Vendetta] How-To Guide Submission";
$email = "The following How-To Guide information has been submitted:\n\nUser Name:\t$ConName\nUser Email:\t$ConEmail\nUser IP:\t$REMOTE_ADDR\nUser URL:\t$Address\nUser Comments:\t$Comments\n\nHow-To Guide:\n$Guide\n\n";
mail($to, $subject, $email, "From: [email][email protected][/email]); //sends mail
/***************************************
** send confirmation email to contact **
***************************************/
$to = $ConEmail;
$mailheaders = "X-Mailer: PHP/" . phpversion();
$mailheaders .= "From: $AdminMail\n";
$subject = "[Vendetta] How-To Guide Submission";
$email = "[Vendetta]\nThe Unoffical UConn UT2003 Server\nHow-To Guide Submission\n\n========================================================\nYou have submitted the following information:\n\nName:\t$ConName\nEmail:\t$ConEmail\nURL:\t$Address\nComments:\t$Comments\n\nHow-To Guide:\n$Guide\n\n========================================================\nYou will be notified via email when your how-to guide is posted.\nIf any of this information is incorrect please re-submit\nthe form with the corrections in the comments field.\n\nIf you did not submit this information and would like to have it removed, please send an email to [email]UConnVendetta@hotmail.com[/email] immediately.\n\nBest regards,\n\n\nJazzman Will Rosenberg\nChief Admin of [Vendetta]\nhttp://vendetta.n3.net\nAIM: UConnVendetta, CollegeGuy184\n\n";
mail($to, $subject, $email, $mail_headers); //sends mail
/************************
** show thank you page **
*************************/
include("HowTo_thanks.html"); //sends user to customized thank you page
}
?>
I don't understand what the problem is here. Everything should be working. Do I need to have my sendmail_from variable match my From header or something?