
Hi Lawi, What is you mail server? Does it require authentication? On Fri, Sep 25, 2009 at 4:15 PM, Mr. Lawi <mail2lawi@gmail.com> wrote:
Hi Devs,
I have this script and for the life of me I cant tell where the problem is. It is submitting successfully but the mail is not being sent. As in the $to does not get the email. Could it be a problem with the hosting?
<?php session_start(); $uname = "1234"; $email = "test@test.test"; $phone = "1234"; $query = "How to 123"; $message = "Name: " . $uname . "\n\n" . "Phone Number: " . $phone . "\n\n" . "Email Address: " . $email . "\n\n" . "Query: " . $query;
function redirect($msg, $page) { $_SESSION['msg'] = $msg; header("Location: $page"); exit(); }
//$message = $uname . \n\n . $phone . $to = "mail2lawi@gmail.com"; $receiver = "My Test Site"; $subject = "Contact Us Form"; $headers .= "From:" . $email . "\r\n"; $headers .= "X-Mailer: Unknown"; if(mail($to, $subject, $message, $headers)) { //print "success, mail successfully sent to $to"; $msg = "Mail sent to $receiver"; $page = $_SERVER['HTTP_REFERER']; $_SESSION['status'] = $msg; redirect($msg, $page); } else { //print "failure, mail failed to be sent to $to"; $msg = "Mail not sent to $receiver"; $page = $_SERVER['HTTP_REFERER']; redirect($msg, $page); } ?>
_______________________________________________ Skunkworks mailing list Skunkworks@lists.my.co.ke http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks Other services @ http://my.co.ke Other lists ------------- Announce: http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks-announce Science: http://lists.my.co.ke/cgi-bin/mailman/listinfo/science kazi: http://lists.my.co.ke/cgi-bin/mailman/admin/kazi/general
-- Regards, Brian Ngure