Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

PHP mail set-up for a contact form

Hi,
I have joined Infinity Free a few hrs ago, very excited to bring over a site I have been working on. I was asked to do a contact page but I am stumped trying to get the php mailer to work. Any help with a setup guide would be appreciated for this server.
Site: http://my80stoys.rf.gd/
I currently have a contact form template as the index file, when I add the values it all says email sent, but I receive no emails. I know very little about php.
Any help is much appreciated. Thankyou.
My php code is below.

// Enter the email where you want to receive the message
$emailTo = '********@hotmail.com';

$clientEmail = addslashes(trim($_POST['email']));
$subject = addslashes(trim($_POST['subject']));
$message = addslashes(trim($_POST['message']));
$antispam = addslashes(trim($_POST['antispam']));

$array = array('emailMessage' => '', 'subjectMessage' => '', 'messageMessage' => '', 'antispamMessage' => '');

if(!isEmail($clientEmail)) {
    $array['emailMessage'] = 'Invalid email!';
}
if($subject == '') {
    $array['subjectMessage'] = 'Empty subject!';
}
if($message == '') {
    $array['messageMessage'] = 'Empty message!';
}
if($antispam != '12') {
    $array['antispamMessage'] = 'Wrong antispam answer!';
}
if(isEmail($clientEmail) && $subject != '' && $message != '' && $antispam == '12') {
    // Send email
    $headers = "From: " . $clientEmail . " <" . $clientEmail . ">" . "\r\n" . "Reply-To: " . $clientEmail;
    mail($emailTo, $subject . " (bootstrap contact form tutorial)", $message, $headers);
}

echo json_encode($array);

Comments

  • What address are you using for $clientEmail in this example? If that's a Hotmail address or the same as the address you're sending the e-mail to, it's never going to arrive because Hotmail will just reject it. If you send it from a Gmail address to Hotmail, the chances are better, but still not good.

    For the best results, you should always send your e-mail from an address under your own domain. So if your hosting account is for the domain example.rf.gd, then using an address like contact@example.rf.gd will give you the best chances of getting the e-mail delivered.

    You see, most big e-mail providers marked their domains so only their own servers are valid senders for the domain. Hotmail only marked Hotmail servers as authorized senders. If they didn't, it would allow anyone to impersonate any Hotmail user which, of course, is bad.

  • Thank-you for the fast reply, I made a email account from my domain and now I have it working. Very much appreciated.
    Thankyou once again.

This discussion has been closed.