Sending email

panteism

New Member
Messages
3
Reaction score
0
Points
0
I used to have my website in another webhost and my contact form worked fine. Now, In x10hosting my form doesn't deliver e-mails and I don't get any message error. My code is the following:

PHP:
<?php
    $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    $from = 'From: opep'; 
    $to = 'myemail@live.com.pt'; 
    $subject = 'Contacto Via OPEP';
    $human = $_POST['human'];

    $body = "Nome: $name\nE-Mail: $email\nMensagem: $message";

    if ($_POST['submit'] && $human == '4') {
        if (mail ($to, $subject, $body, $from)) {
        echo '<p>A sua mensagem foi enviada.</p>';
    } else {
        echo '<p>Algo correu mal com o envio. Tente novamente.</p>';
    }
    } else if ($_POST['submit'] && $human != '4') {
    echo '<p>Respondeu erradamente à pergunta anti-spam.</p>';
    }
?>

Why is it happening and how to solve it?

Thanks in advance
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
In order to stay off of the spamhaus lists (and to prevent fraud), x10Hosting does not allow spoofing of email headers. Your From header needs to be an actual email account on your domain or the mail will be killed by the server before it's sent. You won't get a PHP error, since the PHP part of the job is working properly, but the outgoing mail router will just discard the message.
 

panteism

New Member
Messages
3
Reaction score
0
Points
0
First of all thank you for your answer Essellar.

I'm quite new to php, I've tried to make some changes in the code but without success.

In the other hand, I've created an e-mail in my x10 account - mail@panteismo.x10.mx - but it seems I can't send or receive anything... I've tried this in the webmail...

Any tips?
 
Top