Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Problem with Gmail

  1. #1
    Join Date
    Nov 2006
    Posts
    116
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Problem with Gmail

    Hi guys,

    I hope that i'm in the right place. I have this problem. I use the below script on my website which sends email to my gmail account. It was working fine for a few days but somehow now it's not working. If i use another email, it works OK! Anyone has any ideas as to what is wrong?

    script

    <?php
    @extract($_POST);
    $name = stripslashes($name);
    $email = stripslashes($email);
    $country = stripslashes($country);
    $subject = stripslashes($subject);
    $comment = stripslashes($comment);
    $company = stripslashes($company);
    $asb = stripslashes($asb);
    $address = stripslashes($address);
    mail('mygmail@gmail.com',$subject,"A message from $name from($country) has been received as follows:
    Comment: $comment

    Company Name: $company
    ASB Number: $asb
    Address: $address
    ","From: $name <$email>");
    header("location:thankyou.htm");
    ?>

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I have no idea why that would not work. Does it fail to send the email or do you not receive the email at your gmail account?
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Nov 2006
    Posts
    116
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    It used to send the emails before and i used to receive it. (though it was going into the spam folder but i created a filter to solve it). But now i don't get anything in my inbox. It can't be the sending problem coz when i type in another email (myemail@mydomain.com) it works fine. So i assume the problem is my gmail is not receiving any mails!

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    It's really hard to figure out what is wrong then.
    Try this:
    if (mail(....SAME AS ABOVE...)) { echo 'it works'; } else { 'it is broken'; }
    To understand:
    'it works': this means the server believes the mail was sent; it probably was; something is wrong with gmail getting the email
    'it is broken': your server knows it didn't work; the submission was rejected and not sent

    Beyond that, I suggest looking carefully in your gmail inbox/spam/etc.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Nov 2006
    Posts
    116
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Hi Djr33,

    Thank you very much for helping, but where do i put this code and what will it do?

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    You are just adding if (....) around the mail() function. This means that you can find out what happened.
    Every function has a "return" (result) value. This is what the function "equals".
    So you can also do:
    if (mail(....)==TRUE)
    But the code above is just a shortcut.

    In other words, you'll get TRUE for success and FALSE for failure.


    (Note: many functions return other values, like text or numbers, but if nothing else they use TRUE and FALSE, and even if they are supposed to return text or numbers, it is common that they will return FALSE if something goes wrong.)
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  7. #7
    Join Date
    Nov 2006
    Posts
    116
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Thanks a lot. i will try it and see

  8. #8
    Join Date
    Nov 2006
    Posts
    116
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    it works
    Warning: Cannot modify header information - headers already sent by (output started at /home/webadmin/else.com/html/process.php:17) in /home/webadmin/else.com/html/process.php on line 18


    this is what i get when i click submit button

    script

    <?php
    @extract($_POST);
    $name = stripslashes($name);
    $email = stripslashes($email);
    $country = stripslashes($country);
    $subject = stripslashes($subject);
    $comment = stripslashes($comment);
    $company = stripslashes($company);
    $asb = stripslashes($asb);
    $address = stripslashes($address);
    if ( mail('my.companysupport@gmail.com',$subject,"A message from $name from($country) has been received as follows:
    Comment: $comment

    Company Name: $company
    ASB Number: $asb
    Address: $address
    ","From: $name <$email>")){ echo 'it works'; } else { 'it is broken'; };
    header("location:thankyou.htm");
    ?>

  9. #9
    Join Date
    Mar 2008
    Posts
    122
    Thanks
    17
    Thanked 5 Times in 5 Posts

    Default

    At the very top of the script put:
    PHP Code:
    ob_start(); 
    and at the bottom put:
    PHP Code:
    ob_end_flush(); 

  10. #10
    Join Date
    Nov 2006
    Posts
    116
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    i get this error now

    Parse error: parse error in /home/webadmin/else.com/html/process.php on line 19

    Can you please give me the full script so that i can just copy and paste. Coz i maybe making some mistake

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •