SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question php mail going in spam

    Hi, i have tried everything i can find on net to make my script not getting into spam but its not working, i tried on google and hotmail too. what should i do, maybe i m missing something. here is my code
    PHP Code:

                                    $to 
    "abc@gmail.com";
                                
                    
                    
    $fromname "";

                    
    $random_hash md5(date('r'time()));
            
    //define the headers we want passed. Note that they are separated with \r\n
            
    $headers "MIME-Version: 1.0\n";
            
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"
    //        $headers .= "boundary=\"PHP-alt-".$random_hash."\"\r\n";
            
    $headers .= "X-Priority: 3\r\n";
                    
    $header .= "Reply-To: No Reply <no-reply@abc.org>\r\n"
                    
    $headers .= "Return-Path:<no-reply@abc.org>\r\n";
            
    $headers .= "X-MSMail-Priority: Normal\r\n";
            
    $headers .= "X-Mailer: php\r\n"
                    
    $headers .= 'From: ' $fromname '<' $mailfrom '>' "\r\n";


                    
    $subject "United!";
                    
    //$subject = html_entity_decode($subject, ENT_QUOTES);

                    
    $message html_entity_decode($bodyENT_QUOTES);
            if(!
    mail($to$subject$message$headers"-f $mailfrom"))
            {
                echo 
    "Mail is not sent for user id = ".$user_id;
            }else{
                echo 
    "Mail is sent for user id = ".$user_id;
            } 
    All those who wander aren't lost.

  2. #2
    I solve practical problems. bronze trophy
    Michael Morris's Avatar
    Join Date
    Jan 2008
    Location
    Knoxville TN
    Posts
    2,015
    Mentioned
    62 Post(s)
    Tagged
    0 Thread(s)
    "no-reply" is a spam-bait email address. Other than that I didn't spot anything at a cursory glance. If your server is blacklisted there's nothing you can do short of directly whitelisting. I would recommend using the phpMailer class rather than the native php mail function both for security and to get the headers of the email right, which is difficult.

    In brief though there are two ways to be labeled spam. 1, get blacklisted. 2. get a header or two wrong. 2 in testing can cause 1 unfortunately. Spam filters are notoriously fickle, and even Fortune 500 businesses who do bulk emails run afoul of them from time to time.

  3. #3
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    i did tried with subscribe thing too instead of no-reply but didn't work
    All those who wander aren't lost.

  4. #4
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    What's in the body of the e-mail?

    If there's a lot of HTML, images and little actual content, that might make Google/ Hotmail think it's spam.
    If you send it with a plain text body instead, does the mail arrive properly?

  5. #5
    SitePoint Member
    Join Date
    Dec 2006
    Location
    York, UK
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What server is the email being sent on, and has the IP address of that server been blacklisted?

    See: http://www.mxtoolbox.com/
    Jon Irvine | York, UK | Designition Ltd

  6. #6
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Immerse View Post
    What's in the body of the e-mail?

    If there's a lot of HTML, images and little actual content, that might make Google/ Hotmail think it's spam.
    If you send it with a plain text body instead, does the mail arrive properly?
    Yes i tried but its going in spam.
    what should i do
    All those who wander aren't lost.

  7. #7
    SitePoint Wizard nofel's Avatar
    Join Date
    Aug 2007
    Location
    Earth
    Posts
    1,766
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jonirvine View Post
    What server is the email being sent on, and has the IP address of that server been blacklisted?

    See: http://www.mxtoolbox.com/
    thanks, that was helpful. in many server responses. one came blacklist. the website says 'we notice you are blacklisted'
    All those who wander aren't lost.


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
  •