SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Longueuil, QC
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mail() problem - not working with POP address???

    Hey everyone,

    I've been trying stuff for a while now, and I just can't find a way to way to fix it.

    I have this function to send email to a list of email contained in a MySQL database. Here it is:

    PHP Code:
    set_time_limit(0);
    ignore_user_abort();

    $send_to = array();

    // If its a test, send only to admin's email
    if ( isset($test) )
    {
        
    $send_to[] = $config['admin_email'];
    }
    // Else send to all registered users
    else
    {
        
    $newsletter_data db_select("SELECT `newsletter_email` FROM `newsletter`");
        for (
    $i 0$i count($newsletter_data); $i++)
        {
             
    $send_to[] = $newsletter_data[$i]['newsletter_email'];
        }
    }

    // Fix strings to send in nice HTML
    $message str_replace(array("&gt;""&lt;""\&quot;""&amp;"), array('>''<''"''&'), $message);

    // Check if the user chose TEXT ONLY or HTML.
    if ($type_value == 'html')
    {
        
    $message stripslashes($message);
    }
    else
    {
        
    $message '<font face="arial, verdana, helvetica" size="2">' stripslashes(nl2br($message)) . '</font>';
    }

    // Prepare message for the newsletter
    $subject stripslashes($subject);
    $object $config['newsletter_title'] . ' (' date("m.d.y") . '): ' $subject;
    $message $message "<br><br>";

    // Go through all email in $send_to array and send newsletter
    for ($i 0$i count($send_to); $i++)
    {
        
    // Add unregister message at the bottom of the message
        
    $unregister_message '<br><hr align="left" width="150" size="1" noshade><a href="http://www.hymnfromabove.com/~glambert/prod/adviso/desabonnement.php?email=' $send_to[$i] . '">Cliquez ici pour vous désabonnez</a>';

        
    $headers "MIME-Version: 1.0\n";
        
    $headers .= "Content-Type: text/html; charset=iso-8859-1\n";
        
    $headers .= "From: \"" $config['newsletter_sender'] . "\" < " $config['newsletter_email'] . " >\n";
        
    $headers .= "X-Priority: 1\n";
        
    $headers .= "X-MSMail-Priority: High\n";
        
    $headers .= "X-Mailer: PHP / ".phpversion()."\n";

        
    mail("<" $send_to[$i] . ">"$object$message $unregister_message$headers);


    Did I miss something? Is something wrong in my code? Or is it possible that my Outlook Express's configuration is ****ed? I've tried with 2 different POP (from 2 diff. ISP) and they don't work.

    The mail() function works with hotmail and other free ISP.

    PLEASE help a poor soul!

    Thanks

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Longueuil, QC
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    NOTE: I've put my script on another server and now it works fine for the POP address ...

    Could it be a PHP setting on my server that makes this?

    Please help me!

    P.S - Do you think this script could handle, lets say, a 10 000 subscriber newsletter send?

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2002
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In troubleshooting this you may find it more useful to use mail(); by itself as a test without any special headers or anything.. and see if it will send to the pop addresses.

    If you say it works on another php host then, yes, it sounds like you may have a configuration problem.

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2003
    Location
    Longueuil, QC
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, even weirder now:

    On server #1 : NOT the same server as my POP account. When I send a newsletter to lets say 50 people and my POP address is in the list, it successfully gets to all ISPs (hotmail, yahoo etc.) but NOT to my POP.

    On server #2 : SAME server as my POP account. When I send a newsletter to the same amount of people with in the list my POP account and some hotmail / fowarding accounts of mine, it ONLY gets to the POP account and NOT the hotmail/fowarding ones ...

    What could possibly do that? I've been researching a long time for this and haven't found anything. Please help I'm getting desperate! Thanks!


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
  •