PHP mail form with Fasthosts server problem

Discussion in 'PHP' started by sisom, Jan 22, 2011.

  1. #1
    Hi, I've been trying to use a simple contact form on a static website that I have hosted on a Fasthosts server, but Fasthosts have strict conditions on how the form should be set up, and I just can't get it to send mail.

    This is Fasthosts' knowledge base about the conditions they require:

    http://www.fasthosts.co.uk/knowledge-base/?article_id=70

    I have been testing this simple file, mailtest.php, which is as follows:

    <?php
    mail('sales@mydomain.com','test message','this is a test sending mail from PHP','From: sales@mydomain.com' . "\r\n" . 'Reply-To: sales@mydomain' . "\r\n" . 'X-Mailer: PHP/', "-fsales@mydomain.com");
    ?>

    I have a dedicated Fasthosts server, and I have tried running this file from the root of my website (which I shall call 'mydomain.com'), but no mails are sent.
    I also have an older Fasthosts hosting account, Windows Home, for around £5 a month, and if I use this PHP file on that site, (obviously changing the 'from' address to the e-mail address for that site) then it works fine!

    Is there anything obvious that I have done wrong in the PHP above?
    I have gone into /etc/mail/trusted-users and added
    www-data
    as the user, but that didn't help either.

    Please let me know if there is any other information I can give that might help, I've spent over five hours trying to work this out but so far no luck, I am very grateful for any help you can offer.
     
    sisom, Jan 22, 2011 IP