Php mail function won't work

html
apache
php
server

#1

Hey guys,

So I’m trying to make a simple html form using bootstrap that sends an email after the user hits submit.

This code is my form:

		  	<div class="form-group">
		      <label class="control-label col-md-4" for="name">Name:</label>
		      <div class="col-md-4">
		        <input type="text" class="form-control" name="email" id="name" placeholder="Enter Full Name" required>
		      </div>
		    </div>
		    </br>
	
		    <div class="form-group">
		      <label class="control-label col-md-4" for="pwd">Email:</label>
		      <div class="col-md-4">
		        <input type="text" class="form-control" name="email" id="email" placeholder="Enter Email" required>
		      </div>
		    </div>
		    </br>
		  	
		    <div class="form-group">
		    	<label class="control-label col-md-4" for="pwd">Message:</label>
		    	<div class="col-md-4">
		    		<textarea class="form-control" name="message" id="message" rows="5" placeholder="Enter Your Message" required></textarea>
		    	</div>
		    </div>
			
			<div class="form-group">
				<div class="col-md-offset-4 col-md-1">
					<button type="submit" class="btn btn-default" name="submit">Submit</button>
				</div>
			</div>
		  </form>

Then this is my process php file that sends an email:
<?php
if (isset($_POST[‘submit’])) {
msg = 'Name: ' ._POST[‘name’] ."\n"
.'email: ’ ._POST['email'] ."\n" .'Message : ' ._POST[‘message’];
$msg = wordwrap($msg, 70);
mail(‘killahkid1992@gmail.com’, ‘Sample Contact Message’, $msg);
header(‘location:contact_us_thank_you.php’);
} else {
header(‘location: contact_us.php’);
exit(0);
}
?>

The contact_us_thank_you.php has one tag that simply says thank you to the user. I’m using the php, apache workspace. When I start the server and run a preview, I filled out the form and it goes to the thank you page, but I don’t receive the email in my inbox. Is this a cloud9 issue or did I mess something up along the way?


#2

Outbound SMTP is blocked. How can I send email from my app?