I have this contact form that I use for everything and for some reason it is not working on this one site. If you could visit it and see what is wrong. http://www.spencedesign.netau.net/lori/me.html
the php code is here

<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];

$mail_to = 'jeremy_spence@rocketmail.com';
$subject = 'Message from a site visitor '.$field_name;

$body_message = 'From: '.$field_name."\n";
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;

$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";

$mail_status = mail($mail_to, $subject, $body_message, $headers);

if ($mail_status) { ?>
    <script language="javascript" type="text/javascript">
        alert('Thank you for the message. We will contact you shortly.');
        window.location = 'http://www.jeremyspence.net78.net';
    </script>
<?php
}
else { ?>
    <script language="javascript" type="text/javascript">
        alert('Message failed. Please, send an email to jeremy_spence@rocketmail.com');
        window.location = 'http://www.jeremyspence.net78.net';
    </script>
<?php
}
?>

and the HTML is

<div id="contact-area">
    <form action="contact.php" method="post">
    Your name<br>
    <input type="text" name="cf_name"><br>
    Your e-mail<br>
    <input type="text" name="cf_email"><br>
    Message<br>
    <textarea name="cf_message"></textarea><br>
    <input type="submit" value="Send" class="submit">
</form>
    </div>

Recommended Answers

All 3 Replies

Hi,

try running this script

<?php

echo (function_exists('mail')?'You have mail function enabled in this server': 'No it is not enabled, please contact your hosting provider ASAP');

or

<?php

  phpinfo();

If using the second option above, look for the send_mail directives...e.g. sendmail_from, sendmail_path. If it is not listed on the directives, then you will have to contact your host to find out how to enable it. NOrmally, this is enabled by default.

I have also have an account in www.000webhost.com. They will provide the hosting and all but not the mail(). If you want to send mails means go for another free hosting or get a hosting. I have tried your code its working well and good.

Thank you all. But I have a website with 000webhost that does work for email. Maybe it is only one per account. No worries. 000 is just. A placeholder before I buy the domain. Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.