Problems with mail()

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Robson

    #1

    Problems with mail()

    I'm just tinkering with PHP and learning the basics ; all well and good
    so far, except I can't get mail() to work.

    I'm running Apache 2 & PHP 4.3.9, and ssmtp on Gentoo. ssmtp is set up
    correctly (I can use "sendmail" in evolution fine).

    When I post from PHP it seems to work ok except it's emailed to
    apache@autismuk .freeserve.co.u k (according to my log). I've tried setting
    the sendmail directory option in php.ini to /usr/lib/sendmail & that
    doesn't work either..... I'm mystified.

    Am I doing something obviously wrong ?
    Any ideas ?

    <?php

    $msg = "Name: $_POST[name]\n";
    $msg .= "E-Mail: $_POST[email]\n";
    $msg .= "Message: $_POST[message]\n";

    $recipient = "autismuk@autis muk.freeserve.c o.uk";
    $subject = "Form submission results";
    $mailheaders = "From: My Web Site <autismuk@autis muk.freeserve.c o.uk> \n";
    $mailheaders = "Reply-To: $_POST[email]";
    $mailheaders = ""; // this line in or out makes no odds ....
    mail($recipient ,$subject,$msg, $mailheaders) or die("Failed to send");

    print "Message sent successfully.<b r>";

    ?>
  • Theo

    #2
    Re: Problems with mail()

    Paul Robson <autismuk@autis muk.freeserve.c o.uk> wrote in
    news:pan.2004.1 0.25.13.04.40.8 71057@autismuk. freeserve.co.uk :
    [color=blue]
    > $recipient = "autismuk@autis muk.freeserve.c o.uk";[/color]

    try

    $recipient = "<autismuk@auti smuk.freeserve. co.uk>";

    Comment

    Working...