mail() sometimes sends blank emails

Discussion in 'PHP' started by mameha1977, Feb 12, 2007.

  1. #1
    I'm using the simple mail() function.

    mail($To, $Subject, $Message, $headers);

    95% of the time it works fine, but twice now it has sent out the mail using the correct 'to' and 'message' fields but the 'subject' and 'headers' were empty.

    I declare the 'subject' immediately before sending the mail with this line:

    $Subject = "Quote (".$thecountry."/".$lang.") ".strip_tags($_POST['company_name']);

    The headers are also set in this way, then the mail is sent. I can't think of anything that would cause the values to disappear such as using sessions etc.

    Whats going on here?
     
    mameha1977, Feb 12, 2007 IP
  2. designcode

    designcode Well-Known Member

    Messages:
    738
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    118
    #2
    Well in my case, email send using php mail() function end up in bulk/junk folder. User phpMailer Class, its really awesome and easy to use.
     
    designcode, Feb 12, 2007 IP
  3. Clive

    Clive Web Developer

    Messages:
    4,507
    Likes Received:
    297
    Best Answers:
    0
    Trophy Points:
    250
    #3
    Clive, Feb 12, 2007 IP
  4. grandpa

    grandpa Active Member

    Messages:
    185
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    75
    #4
    thx for the link, i really need it too
    does this function detect bounced mail?
     
    grandpa, Feb 13, 2007 IP
  5. Clive

    Clive Web Developer

    Messages:
    4,507
    Likes Received:
    297
    Best Answers:
    0
    Trophy Points:
    250
    #5
    No, you cannot detect bounced mail. That is the job of the script you need to use phpmailer with.
    What you can do instead is request read receipts, but then it will only work with some email clients. Here's the code:
    $mail->ConfirmReadingTo = "your@address";
    PHP:
     
    Clive, Feb 13, 2007 IP
  6. Icheb

    Icheb Peon

    Messages:
    1,092
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #6
    In my opinion read receipt requests are the second most annoying part of e-mails right after spam.
     
    Icheb, Feb 13, 2007 IP
  7. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #7
    It's not like it provides reliable data anyway, it's a natural reaction for anyone that uses a computer a lot to press no when they see one of those little boxes pop up incase its some bingo game or pornware or some shit .....
     
    krakjoe, Feb 13, 2007 IP