Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP Email Subscribe form - Not sending mail - Checked php.ini settings already?
    primarykey
    data
    text
    <p>just a little help with this PHP email form, I have checked other questions on here but have found no solution yet.</p> <p>I have a very simple PHP email subscribe form on my webpage, however it doesn't send the mail. Thought it could be a problem with my php.ini but that all seems to be good. Just wanted someone to look at the code on here and see if I'm being stupid or not!</p> <pre><code>&lt;?php $email_to = "subscribe@roomsby.com"; $success_message = "Thank you for subscribing to Roomsby.com. We will get back to you with details of our launch very soon!"; $site_name = "www.roomsby.com"; $email = trim($_POST['email']); $submitted = $_POST['submitted']; if(isset($submitted)){ if($email === '' || $email === 'Enter your email address' ) { $email_empty = true; $error = true; } elseif (!preg_match("/^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$/i", $email)){ $email_unvalid = true; $error = true; } } if(isset($error)){ echo '&lt;span class="error_notice"&gt;&lt;ul&gt;'; if($email_empty){ echo '&lt;li&gt;Please enter your email address&lt;/li&gt;'; } elseif ($email_unvalid) { echo '&lt;li&gt;Please enter a valid email address&lt;/li&gt;'; } else { echo '&lt;li&gt;An error has occurred while sending your message. Please try again later.&lt;/li&gt;'; } echo "&lt;/ul&gt;&lt;/span&gt;"; } if(!isset($error)){ $subject = 'Newsletter Submission'; $body = "Email: $email"; $headers = 'From: ' . $site_name . ' &lt;' . $emailTo . '&gt; ' . "\r\n"; $headers .= 'Reply-To: ' . $email; mail($email_to, $subject, $body, $headers); echo '&lt;span class="success_notice"&gt;' . $success_message . '&lt;/span&gt;'; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload