I have a simple php mailer script I often use on sites and I am trying to integrate it into a facebook app. The app is running through Heroku as usual and is set up correctly.
The Form however is not working, it goes through all the motions but doesn’t actually send the email.
I wonder if anyone can shed any light on this? Essentially its a competition answer form for a facebook page tab app. Should I be using a fb:form or something?
Thanks in advance
Kev
HTML FOR FORM
<form action="mailer.php" id="form" method="post" name="form">
<div class="field form-inline">
<label class="contact-info" for="txtName">Name*</label> <input class=
"txt" id="name" name="name" type="text" value="">
</div>
<div class="field form-inline">
<label class="contact-info" for="txtEmail">Email*</label> <input class=
"txt" id="email" name="email" type="text" value="">
</div><br>
<br>
<br>
<br>
<div class="submit">
<input class="submit" name="submit" type="submit" value="Submit Form">
</div>
</form>
PHP FOR FORM
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$form_message = "Name: $name \nEmail: $email";
// echo for form completion
$myString = "Thank you for filling out our feedback form.";
echo $myString;
//header( "Location: http://www.google.com");//
mail("kevinhowbrook@me.com", "Email Subject", $form_message, "From: $email" );
?>
As long as you can debug (and the echoed text shows up), i am guessing it´s a problem with the mail function itself. If you don´t use it with additional info, any spam filter will block it.
Some pages i found with a quick google search:
http://www.transio.com/content/how-pass-spam-filters-php-mail
http://www.velvetblues.com/web-development-blog/avoid-spam-filters-with-php-mail-emails/
You can also use a PHP mailer class, like this one:
http://code.google.com/a/apache-extras.org/p/phpmailer/