A
Anonymous
Guest
I need help. This code only sends an email to my certain email addresses.
Does anybody see anything wrong with the mail() code? Do I need to send anything preceeding the mail()? Is it assumed to be a spam and that is why is being block?
Tanks
Does anybody see anything wrong with the mail() code? Do I need to send anything preceeding the mail()? Is it assumed to be a spam and that is why is being block?
Tanks
Code:
<?php //Script SendEmailNow.php
if (isset($_POST['submit'])) { //Handle the Form
$error_message = NULL;
// Check for Your_Name -----------------
if (strlen($_POST['Your_Name']) > 0) {
$Your_Name = TRUE;
} else {
$Your_Name = FALSE;
$error_message .= '<P>You forgot to enter your name!<BR>';
}
// Check for Your_Email -----------------
if (strlen($_POST['Your_Email']) > 0) {
$Your_Email = TRUE;
} else {
$Your_Email = FALSE;
$error_message .= 'You forgot to enter your E-mail!<BR>';
}
// Check for Friend_Email_1 -----------------
if (strlen($_POST['Friend_Email_1']) > 0) {
$Friend_Email_1 = TRUE;
} else {
$Friend_Email_1 = FALSE;
$error_message .= 'You forgot to enter your friends E-mail!<BR>';
}
// Check for Friend_Email_2 -----------------
if (strlen($_POST['Friend_Email_2']) > 0) {
$Friend_Email_2 = TRUE;
} else {
$Friend_Email_2 = FALSE;
}
// Check for Friend_Email_3 -----------------
if (strlen($_POST['Friend_Email_3']) > 0) {
$Friend_Email_3 = TRUE;
} else {
$Friend_Email_3 = FALSE;
}
if ($Your_Name && $Your_Email && $Friend_Email_1) { //All entries are OK!
// Send an email.
$body= "I recommend this website about the history of BPM. ";
$subject = "Check this interesting website!";
$headers = "From: {$_POST['Your_Email']}"."\r\nCc: {$_POST['Your_Email']}";
$headers .= "\r\nBcc: myemail@domain.com";
mail ($_POST['Friend_Email_1'], $subject, $body, $headers);
if ($Friend_Email_2) {
mail ($_POST['Friend_Email_2'], $subject, $body, $headers);
}
if ($Friend_Email_3) {
mail ($_POST['Friend_Email_3'], $subject, $body, $headers);
}
$name = ucwords($_POST['Your_Name']);
$name = urlencode($name);
//$name = urlencode($_POST['Your_Name']);
header ("Location: http://www.mywebsite.com/Submital.php?name=$name");
exit();
} else {
$error_message .= '<P>Please try again.<P>';
}
}
#Set page title and include the HTML header
$page_title = 'Email to a Friend.';
include ('./header.inc');
# ------------------------------ web-page -------------------------------------
// Print error message if there is one ----------------------------
if (isset($error_message)) {
echo '<FONT FACE="verdana, arial, times" SIZE=2 COLOR="Red">', $error_message, '</FONT>'; //52 line
}
?>
<!- -------------------------[Request Info Form]------------------------------>
<TABLE ALIGN=Left WIDTH=100% BORDER=0 CELLPADDING=5 CELLSPACING=2 VSPACE=10>
<TR>
<TD ALIGN=Left><FONT COLOR="#000000">
<FORM ACTION="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="POST">
<INPUT TYPE=reset VALUE="Clear">  
<FONT COLOR="#006699" FACE="arial, times" SIZE=3><B>To recommend this page to a friend, please fill in the form below:</B></FONT><P>
</TD>
</TR>
</TABLE>
<BR CLEAR=ALL>
<!- ----------------------------[Parameters]--------------------------------->
<INPUT SIZE=50 NAME="Your_Name" VALUE="<?php if (isset($_POST['Your_Name'])) echo $_POST['Your_Name']; ?>" >
Your Email :<INPUT SIZE=50 NAME="Your_Email" VALUE="<?php if (isset($_POST['Your_Email'])) echo $_POST['Your_Email']; ?>" >
1st - Friend's Email : <INPUT SIZE=50 NAME="Friend_Email_1" VALUE="<?php if (isset($_POST['Friend_Email_1'])) echo $_POST['Friend_Email_1']; ?>" >
2nd - Friend's Email: <INPUT SIZE=50 NAME="Friend_Email_2" VALUE="<?php if (isset($_POST['Friend_Email_2'])) echo $_POST['Friend_Email_2']; ?>" >
3rd - Friend's Email: <INPUT SIZE=50 NAME="Friend_Email_3" VALUE="<?php if (isset($_POST['Friend_Email_3'])) echo $_POST['Friend_Email_3']; ?>" >
Hit the SUBMIT MESSAGE button below, to send this information to your friends.<BR>
<INPUT TYPE="submit" NAME="submit" value="Submit message">
</FORM>
<?php
?>[/quote][/quote]