[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

sending mail from debian etch via php script using mail()



I feel this is debian related so i'm asking here. i have a php script where mail is sent to user to let him know all went wll with his submission via a form. after calling the mail() method or function in php all seems well as there is no error reported using this code:

<?php

$id = $row_Recordset1['id'];
$to = $row_Recordset1['email'];
$subject = "Your Newsletter Subscription confirmation";
$body = "<html><body>" .
        "<h2>Thank you for subscribing to our newsletter!</h2>" .
        "<p>To unsubscribe, click here.</p>" . "</body></html>";
$headers =  "From: Subscription Manager <info@xxx.com>\r\n" .
            "MIME-Version: 1.0\r\n" .
            "Content-type: text/html; charset=UTF-8";
if (!mail($to, $subject, $body, $headers)) {
    header( 'Location: http://newsletter/error_subscribe.php' ) ;
   /*header( 'Location: error_subscribe.php' ) ;*/
 
 }
?>

as you can see if the mail() function failed, it would trigger the error page, which it did in testing, but when it is successful and reports no error, no email is received at the destination email address info@xxx.com (not real one used BTW)

So I am trying to figure out where the problem lies on my debian etch box. i do not believe i loaded a mail server on this box. I checket /var/log/mail and /var/log/mail.error  and they have nothing.  I can type mail and it says you have no mail. I recall in past having mail there and I could use the linux mail program and view system sent mail, but other than than I'm kinda clueless.

Why isnt the mail being sent?
what can be the problem?
do i need to add something called sendmail?
what am I supposed to have installed  in order to send mail via a php script?
how do I chech to see if it is install or configure?

I am comfortable with the code part as I have done it successfully in past, but I usuall upload it to a professional host, this is first time on my own production enviornment and it may not be setup right.

Hopefully this gives you an idea of wher I am at in this challange. thanks for any help

Norman

Reply to: