Sorry, I just realised the mails were actually coming but were being sent to spam folder in gmail (and also yahoo mail - I checked)
Its just that the mail was not being delivered to a client under exchange server. Do ISPs do spam filtering and can I tell them to allow specific mail through? I am guessing that is why the mail is not hitting the client's email account.
That or there is spam filtering on exchange as well but I can verify the exchange with the IT team there.
Lawi
Add $headers = "" before $headers .= ""
--
On 9/25/09, Brian Ngure <brian@mystique.boldlygoingnowhere.org> wrote:
> 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
> _______________________________________________
> 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
>
Sent from Gmail for mobile | mobile.google.com
_______________________________________________
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