Sending email

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by panteism, Feb 24, 2012.

  1. panteism

    panteism New Member

    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
  2. essellar

    essellar Community Advocate Community Support

    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.
  3. panteism

    panteism New Member

    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?
  4. panteism

    panteism New Member

    Anyone, please?


  5. Your current From field: $from = 'From: opep';

    You have read, comprehended, and then changed your code, right?

Share This Page