mail() command & inbox & spam box

Discussion in 'PHP' started by globalcashsite, Jan 9, 2010.

  1. #1
    Hi guys,

    I created a small script to send emails with mail() command. I sent test email to three email addresses.

    1. Gmail add (email arrived in Inbox)
    2. Gmail add (email arrived in SPAM)
    3. Yahoo add (email arrived in SPAM)

    I can't understand why email address is coming in Inbox into one email and in SPAM in 2 email addresses?



    GCS
     
    globalcashsite, Jan 9, 2010 IP
  2. iAreCow

    iAreCow Peon

    Messages:
    85
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Gmail let one through, then noticed that the same email is being sent twice to different users and blocked it. Yahoo probably noticed something like spam in your email content. There was a website (which I couldn't remember) that checks your mail content for possible spam (special phrases that count as spam and so on).
     
    iAreCow, Jan 9, 2010 IP
  3. theapparatus

    theapparatus Peon

    Messages:
    2,925
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Check to see if the sending IP address has rDNS assigned to it. Chances are it doesn't but that's something your host will have to fix for you.
     
    theapparatus, Jan 9, 2010 IP
  4. markowe

    markowe Well-Known Member

    Messages:
    1,136
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    165
    #4
    Also, are you specifying FROM, SUBJECT etc? You are probably just experimenting, and so only specifying the recipient's email address, but most spam filters will flag emails that do not have a sender properly specified.
     
    markowe, Jan 9, 2010 IP
  5. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #5
    Either your ip is blacklisted, you don't have a proper mailserver eg. tls and certificates. You didn't supply proper headers.
     
    Kaizoku, Jan 9, 2010 IP
  6. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #6
    the mails depend on which ip they come from too
     
    Bohra, Jan 9, 2010 IP
  7. balaji153

    balaji153 Peon

    Messages:
    96
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    <?php
    $to = "friends email id";
    $subject = "Test mail";
    $message = "Hello! This is a simple email message.";
    $from = "my email id";
    $headers = "From: $from";
    mail($to,$subject,$message,$headers);
    echo "Mail Sent.";
    ?>

    i tried this simple script but it showing error !!!!!!!

    Warning: mail() [function.mail]: SMTP server response: 550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1) in G:\wamp\www\research\mail.php on line 7
    Mail Sent.
     
    balaji153, Jan 9, 2010 IP
  8. smartknight

    smartknight Active Member

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    86
    #8
    Try this code:
    <?php
    $to = 'nobody@example.com';
    $subject = 'the subject';
    $message = 'hello';
    $headers = 'From: ' . "\r\n" .
    'Reply-To: ' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

    mail($to, $subject, $message, $headers);
    ?>
     
    smartknight, Jan 9, 2010 IP
  9. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #9
    i think the server is configured to use a smtp whenever mail command is used
     
    Bohra, Jan 9, 2010 IP
  10. globalcashsite

    globalcashsite Peon

    Messages:
    806
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Hi guys

    Thanks everyone for replying and helping me. I want to clarify some points those are as follows:

    Proper header
    MIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\nFrom: \"GlobalCashSite\" <xxxxxxxxxxxx@ymail.com>\r\nReply-To: \"GlobalCashSite\" <xxxxxxxxxxxxxe@ymail.com>\r\nX-Priority: 3\r\nX-Mailer: PHP 4\r\n

    I am not using domain based email to for from/to reply instead Yahoo email address.

    Unique Subject
    I am using last three digits of timestamp at the end of subject. I used this trick to make subject of each email unique. I am using this

    $unique = substr(time(),7,3);
    $emailsubject1 = $emailsubject." ".$unique;
    mail($line, $emailsubject1, $emailbody, "$email_headers");

    Is this good idea to make subject of each email unique to prevent mails from being considered SPAM??????

    As replied by [B]iAreCow[/B] how I can check that I am not using spam-friendly words in my email?

    As mentioned by [B]theapparatus[/B] how I can check rDNS assignment?

    As mentioned by [B]Kaizoku[/B] how I can check if my IP is not blacklisted?


    GCS
     
    globalcashsite, Jan 10, 2010 IP
  11. theapparatus

    theapparatus Peon

    Messages:
    2,925
    Likes Received:
    119
    Best Answers:
    0
    Trophy Points:
    0
    #11
    http://remote.12dt.com/ Try checking the IP address that's actually assigned to be sending the emails.
     
    theapparatus, Jan 10, 2010 IP
  12. globalcashsite

    globalcashsite Peon

    Messages:
    806
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #12
    Guys

    As per advise of my hosting I also enabled Domain Key and SPF to send emails directly into my subscriber's Inbox but still fail?

    Any help please?

    GCS
     
    globalcashsite, Jan 10, 2010 IP
  13. nedimtx

    nedimtx Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    This code works perfectly for me:

    
    		// Headers 
    			$to = "some@domain.com";
    			
    			$headers = "MIME-Version: 1.0\n";
    			$headers .= "Content-type: text/plain; charset=utf-8\n";
    			$headers .= "From: Example.net <noreply@example.net>\n";
    			$headers .= "X-Mailer: PHP's mail() Function\n";
    			
    			
    			mail($to, "Subject", $message, $headers);
    
    PHP:
    It works for me.. On Live/Hotmail too.
     
    nedimtx, Jan 12, 2010 IP