Page 1 of 1

Simple Email Issue

Posted: Thu Aug 29, 2013 4:47 pm
by fwof1976
I had this code working at one point, then as I finished the website, it stopped working for me. I am not sure what to do. I have tried using different PHP code and it still wont send the email. It transitions as it should from the HTML page to the PHP page, but doesnt send the email out. Any help would be great.

PHP PAGE:

Code: Select all

<?php
$to = "fishwithoutfeet@gmail.com";
$subject = "Website Message";

$message = "Confidential     " . $_POST['confidential_0'] . "\r\n" . "\r\n" .
"Prayer Request " . $_POST['info_0'] . "\r\n" . 
"Message for Pastor Tim: " . $_POST['info_1'] . "\r\n" .
"Message for Pastor Caleb: " . $_POST['info_2'] . "\r\n" .
"Message for Pastor Andrew: " . $_POST['info_3'] . "\r\n" . 
"Message for Pastor Steven: " . $_POST['info_4'] . "\r\n" .
"Message for Tonya: " . $_POST['info_5'] . "\r\n" .
"Other: " . $_POST['info_6'] . "\r\n" .
"Name: " . $_POST['name'] . "\r\n" .
"Email: " . $_POST['email'] . "\r\n" .
"Phone Number: " . $_POST['phone'] . "\r\n" . "\r\n" .
"Reason for Contact: " . $_POST['content'];
$from = $_POST['email'];
$headers = "From: $from" . "\r\n";
$headers = "Bcc: fishwithoutfeet@yahoo.com" . "/r/n";
mail($to,$subject,$message,$headers);
?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bluffton Nazarene Church</title>
<link href="McConnehey_Final2.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#apDiv1 {
	position:absolute;
	width:200px;
	height:115px;
	z-index:1;
	margin-left: auto;
	left: 33%;
}
</style> 
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
</head>

<body>


<div id="wrapper">
<div id="apDiv1"><img src="images/logo.png" width="491" height="265" alt="Bluffton Nazarene Church Logo" /></div>
<div id="header">
</div>
<div class="sidebar">
  <ul id="MenuBar1" class="MenuBarVertical">
  <li><a href="index2.html">Home</a></li>
    <li><a class="MenuBarItemSubmenu" href="#">Want to Know Jesus?</a>
      <ul>
        <li><a href="recjesus.html">Receiving Jesus</a></li>
        <li><a href="whatnow.html">What Now?</a></li>
        <li><a href="jesusvid.html">Jesus Video</a></li>
      </ul>
    </li>
    <li><a href="aboutus.html">About Us</a></li>
    <li><a class="MenuBarItemSubmenu" href="#">Our Staff</a>
      <ul>
        <li><a href="tmiller.html">Lead Pastor Tim Miller</a>          </li>
        <li><a href="creynolds.html">Pastor of Worship & Visitation Caleb Reynolds</a></li>
        <li><a href="amiller.html">Pastor of Youth and Senior Adults Andrew Miller</a></li>
      </ul>
    </li>
    <li><a href="#" class="MenuBarItemSubmenu">Ministries</a>
      <ul>
        <li><a href="children.html">Children</a></li>
        <li><a href="teens.html">Teens</a></li>
        <li><a href="adults.html">Adults</a></li>
        <li><a href="senioradults.html">Senior Adults</a></li>
      </ul>
    </li>
    <li><a href="#" class="MenuBarItemSubmenu">Resources</a>
      <ul>
        <li><a href="sermons.html">Sermons</a></li>
        <li><a href="booksandsites.html">Books and Websites</a></li>
        <li><a href="assistance.html">Assistance</a></li>
      </ul>
    </li>
    <li><a href="contactus.html">Contact Us</a></li>
  </ul>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <div class="calendar">
  <script>
  // Other settings you can customize for your site
  var lcPopupColor="rgba(230, 230, 230, .9)"; /* Try other values like: rgb(230,230,230), #b0c4de, yellow, etc */
  var lcPopupOutline="#333333";
  var lcPopupCornerRadius=20; /* Set to 0 for square corners */
</script>
<script type="text/javascript" src='http://www.localendar.com/js/PublishedIncludeMini.js'></script>

<!-- Place this line where you would like the calendar to appear (in a <div>, table, etc) -->
<script type="text/javascript" src='http://www.localendar.com/public/bln1or5?include=Y&style=M5'></script>
</div>
<div class="info">
<p><span class="headlineSM">Office Hours:</span><br />
  Mon - Fri 8:30-4:30   260.824.0460
 </p>
<p> <span class="headlineSM">Sunday</span><br />
  Sunday School:  9:00-10:00am<br />
  Morning Worship:  10:15-11:30am<br />
  Evening Worship:  6:00-7:00pm
</p>
<p>&nbsp;</p>
<span class="headlineSM">Wednesday</span><br />
Teens:  6:30-8:00pm<br />
Children:  7:00-8:00pm<br />
Adult Bible Study:  7:00-8:00pm<br />
Dare 2 Care:  7:00-8:00pm
<p>&nbsp;</p>
<p class="headlineSM">Español</br>
<p>La Escuela del domingo: ESL 9:00-10:00am (segunda Lengua inglesa) : El Culto <br />
  de la Mañana 9:00-10:00am</p>
<p>(Tradujo de inglés a español) : 10:15-11:30am<br /> Culto Nocturno: 6:00-7:00pm</p>
<p>Los Jóvenes del miércoles: Los Niños 6:30-8:00pm: 7:00-8:00pm</p>
<p>Estudio <br />
  Adulto de Biblia: 7:00-8:00pm</p>
<p>e Atreve 2 Cuidado: 7:00-8:00pm</p>
</p>
</div>
</div>
<div class="content">

<h2>Thanks!</h2>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p class="home"><a href="index2.html">RETURN HOME</a></p>
</div>
<div id="clrbox"></div>
<div id="footer">

<p><strong><a href="index2.html">Home</a></strong>  |  <strong><a href="recjesus.html">Want to Know Jesus?</a></strong>  | <strong><a href="aboutus.html">About Us</a></strong> | <strong><a href="contactus.html">Contact Us</a></strong></p>
<h3>&copy;Copyright 2012 Bluffton Church of the Nazarene</h3>
Site Designed By <a href="http://www.fishwithoutfeet.com"><span class="biz">Fish Without Feet Graphic Design</span></a>
</div></div>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
</script>
</body>
</html>
HTML PAGE:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bluffton Nazarene Church</title>
<link href="McConnehey_Final2.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#apDiv1 {
	position:absolute;
	width:960px;
	height:115px;
	z-index:1;
	margin-left: auto;
	margin-right: auto;
}
</style> 
<script src="../SpryAssets/SpryMenuBar.js" type="text/javascript"></script><script src="../SpryAssets/SpryValidationRadio.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
<script src="../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="../SpryAssets/SpryMenuBarVertical.css" rel="stylesheet" type="text/css" />
<link href="../SpryAssets/SpryValidationRadio.css" rel="stylesheet" type="text/css" />
<link href="../SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
<link href="forms.css" rel="stylesheet" type="text/css" />
<link href="../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="wrapper">
<div id="header">
<div id="apDiv1"><img src="images/logo.png" width="491" height="265" alt="Bluffton Nazarene Church Logo" /></div>
</div>
<div class="sidebar">
  <ul id="MenuBar1" class="MenuBarVertical">
  <li><a href="index2.html">Home</a></li>
    <li><a class="MenuBarItemSubmenu" href="#">Want to Know Jesus?</a>
      <ul>
        <li><a href="recjesus.html">Receiving Jesus</a></li>
        <li><a href="whatnow.html">What Now?</a></li>
        <li><a href="jesusvid.html">Jesus Video</a></li>
      </ul>
    </li>
    <li><a href="aboutus.html">About Us</a></li>
    <li><a class="MenuBarItemSubmenu" href="#">Our Staff</a>
      <ul>
        <li><a href="tmiller.html">Pastor Tim Miller</a></li>
        <li><a href="creynolds.html">Pastor Caleb Reynolds</a></li>
        <li><a href="amiller.html">Pastor Andrew Miller</a></li>
        <li><a href="sspencer.html">Pastor Steven Spencer</a></li>
      </ul>
    </li>
    <li><a href="#" class="MenuBarItemSubmenu">Ministries</a>
      <ul>
        <li><a href="children.html">Children</a></li>
        <li><a href="teens.html">Teens</a></li>
        <li><a href="adults.html">Adults</a></li>
        <li><a href="senioradults.html">Senior Adults</a></li>
      </ul>
    </li>
    <li><a href="#" class="MenuBarItemSubmenu">Resources</a>
      <ul>
        <li><a href="sermons.html">Sermons</a></li>
        <li><a href="booksandsites.html">Books and Websites</a></li>
        <li><a href="assistance.html">Assistance</a></li>
      </ul>
    </li>
    <li><a href="contactus.html">Contact Us</a></li>
  </ul>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <div class="calendar">
  <script>
  // Other settings you can customize for your site
  var lcPopupColor="rgba(230, 230, 230, .9)"; /* Try other values like: rgb(230,230,230), #b0c4de, yellow, etc */
  var lcPopupOutline="#333333";
  var lcPopupCornerRadius=20; /* Set to 0 for square corners */
</script>
<script type="text/javascript" src='http://www.localendar.com/js/PublishedIncludeMini.js'></script>

<!-- Place this line where you would like the calendar to appear (in a <div>, table, etc) -->
<script type="text/javascript" src='http://www.localendar.com/public/bln1or5?include=Y&style=M5'></script>
</div>
<div class="info">
<p><span class="headlineSM">Office Hours:</span><br />
  Mon - Fri 8:30-4:30   260.824.0460
 </p>
<p> <span class="headlineSM">Sunday</span><br />
  Sunday School:  9:00-10:00am
  Morning Worship:  10:15-11:30am
  Evening Worship:  6:00-7:00pm
</p>
<p>&nbsp;</p>
<span class="headlineSM">Wednesday</span><br />
Teens:  6:30-8:00pm
Children:  7:00-8:00pm
Adult Bible Study:  7:00-8:00pm
Dare 2 Care:  7:00-8:00pm
<p>&nbsp;</p>
<p class="headlineSM">Español</br>
<p>La Escuela del domingo: ESL 9:00-10:00am (segunda Lengua inglesa) : El Culto <br />
  de la Mañana 9:00-10:00am</p>
<p>(Tradujo de inglés a español) : 10:15-11:30am Culto Nocturno: 6:00-7:00pm</p>
<p>Los Jóvenes del miércoles: Los Niños 6:30-8:00pm: 7:00-8:00pm</p>
<p>Estudio <br />
  Adulto de Biblia: 7:00-8:00pm</p>
<p>e Atreve 2 Cuidado: 7:00-8:00pm</p>
</p>
</div>
</div>
<div class="content">
<h1>Needing to Contact the Church?</h1>
<p>Help Us Meet Your Needs, please fill in all fields:</p>
<form id="contact" name="contact" method="post" action="email_form.php">
  <fieldset>
    <legend>Your Contact Information</legend>
    <p></p>
    <label for="name">Name:</label>
    <input type="text" name="name" id="name" />
    <br />
    <label for="phone">Phone:</label>
    <input type="text" name="phone" id="phone" />
    <br />
    <span id="email">
    <label for="email">Email:</label>
    <input type="text" name="email" id="email" />
    <span class="textfieldRequiredMsg">Required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
  </fieldset>
  <p>&nbsp;</p>
  <fieldset>
    <legend>How May We Serve You?</legend>
    <p>
    <p>Do You Wish This to be Confidential?<br />
    <span id="spryradio1">
      <label>
        <input type="radio" name="confidential_0" value="PRIVATE" id="confidential_0" />
        yes</label>
      <br />
      <label>
        <input type="radio" name="confidential_1" value="Public" id="confidential_1" />
        no</label>
      <br />
      <span class="radioRequiredMsg">Please make a selection.</span></span></p>
      <p>&nbsp;</p>
      <p>
        <label>
          <input type="checkbox" name="info_0" value="prayer" id="info_0" />
          Prayer Request</label>
        <br />
        <label>
          <input type="checkbox" name="info_1" value="AttnTimMiller" id="info_1" />
          Message for Pastor Tim Miller</label>
        <br />
        <label>
          <input type="checkbox" name="info_2" value="AttnCalebReynolds" id="info_2" />
          Message for Pastor Caleb Reynolds</label>
        <br />
        <label>
          <input type="checkbox" name="info_3" value="AttnAndrewMiller" id="info_3" />
          Message for Pastor Andrew Miller</label>
        <br />
        <label>
          <input type="checkbox" name="info_4" value="AttnStevenSpencer" id="info_4" />
          Message for Pastor Steven Spencer</label>
        <br />
        <label>
          <input type="checkbox" name="info_5" value="AttnTonya" id="info_5"  />
          Church Office</label>
        <br />
        <label>
          <input type="checkbox" name="info_6" value="other" id="info_6" />
          Other</label>
        <br />
      </p>
<br />
      <p>&nbsp;</p>
    <p><span id="sprytextarea1">
      <label for="content">Reason for Contact:</label>
      <br />
      <textarea name="content" id="content" cols="60" rows="10"></textarea>
      <span class="textareaRequiredMsg">Required.</span></span></p>
  </fieldset>
  <p>
    <input type="submit" name="submit" id="submit" value="SEND" />
    <input type="reset" name="reset" id="reset" value="RESET" />
  </p>
</form>
<p>&nbsp;</p>
</div>
<div id="clrbox"></div>
<div id="footer">

<p><strong><a href="index2.html">Home</a></strong>  |  <strong><a href="recjesus.html">Want to Know Jesus?</a></strong>  | <strong><a href="aboutus.html">About Us</a></strong> | <strong><a href="contactus.html">Contact Us</a></strong></p>
<h3>&copy;Copyright 2012 Bluffton Church of the Nazarene</h3>
Site Designed By <a href="http://www.fishwithoutfeet.com"><span class="biz">Fish Without Feet Graphic Design</span></a>
</div></div>
<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});
var spryradio1 = new Spry.Widget.ValidationRadio("spryradio1", {validateOn:["blur"]});
var sprytextarea1 = new Spry.Widget.ValidationTextarea("sprytextarea1", {validateOn:["blur"]});
var sprytextfield1 = new Spry.Widget.ValidationTextField("email", "email", {validateOn:["blur"]});
</script>
</body>
</html>

Re: Simple Email Issue

Posted: Thu Aug 29, 2013 8:30 pm
by Celauran
Is it not sending, or is it not being received? I'd start by capturing the return value of mail() so you can at least ascertain where the failure lies.

Re: Simple Email Issue

Posted: Tue Sep 03, 2013 5:56 pm
by fwof1976
It is not being received. I used a test on it and it came back that it mailed successfully...so I know it is going out. I have tried using other emails to receive it, and have tried just using the code for the mail only, with nothing else, and it goes to the php page and gives me the YES it sent, but is never received by other emails. I am wondering if where the site is hosted from is the issues if the code isnt wrong.

Re: Simple Email Issue

Posted: Tue Sep 03, 2013 6:19 pm
by Celauran
That's entirely possible. The hosting provider could be blacklisted somewhere and the mails are being diverted to spam. Try removing the 'from' header and see if that helps.

Re: Simple Email Issue

Posted: Tue Sep 03, 2013 8:21 pm
by fwof1976
I used the code on another server and had no issues emailing. It seems the server it was on was either blacklisted or just having issues sending and receiving emails. Thanks for the input!