Jump to content

Archived

This topic is now archived and is closed to further replies.

robpicken

html mail problem

Recommended Posts

Hi All,

I'm having a bit of a nightmare with a client who is using the built in Mailing List manager within our CMS. I've used this newsletter system on 10 or so other sites in the past few months and none have had any of the problems that this client seems to be experiencing.

Basically when a preview is looked at it also sends the newsletter to an assigned email address. For this specific client no matter what email@theirdomain it gets sent to it never arrives, any other domain excluding AOL accounts it works fine - they've even tried their private accounts ie hotmail and got other associates of theirs to try it and its working fine.

They use an MX server, at first i thought this was the problem, so i pulled in a favour and got access to one and the system when tested worked fine. I'm now stummped, and highly stressed as i'm lost as to possible causes let alone solutions.

I'm posting the code below, so if anybody can see anything at all wrong then please let me know.

[code]
function send_newsletter($newsletter_id) {

    global $settings;
    global $query;

    $iSQL = "SELECT subject, content FROM ".TABLE_NEWSLETTER_ARCHIVE." WHERE newsletter_id='$newsletter_id'";
        $ires = $query->run_sql($iSQL);
        
        while ($row = mysql_fetch_array($ires)) {
                $subject = $row['subject'];
                $body = $row['content'];
                }

    $x = 1;
    $hold = 10; // quantity of emails sent before 3 sec delay
        
    $headers .= "X-Sender:  ".$settings->general(website_name)." <".$settings->general(general_email).">\n"; //
    $headers .="From: ".$settings->general(website_name)." <".$settings->general(general_email).">\n";
    $headers .= "Reply-To: ".$settings->general(website_name)." <".$settings->general(general_email).">\n";
    $headers .= "Date: ".date("r")."\n";
    $headers .= "Message-ID: <".date("YmdHis").".".$settings->general(general_email).">\n";
    $headers .= "Return-Path: ".$settings->general(general_email)." <".$settings->general(general_email).">\n";
    $headers .= "Delivered-to: ".$settings->general(general_email)." <".$settings->general(general_email).">\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html;charset=ISO-8859-9\n";
    $headers .= "X-Priority: 3\n";
    $headers .= "Importance: Normal\n";
    $headers .= "X-MSMail-Priority: Normal\n";
    $headers .= "X-Mailer: PHP v".phpversion()."\n";
    
        $SQL = "SELECT email, name FROM ".TABLE_NEWSLETTER."";
            $res = $query->run_sql($SQL);
               while ($row = mysql_fetch_array($res) ) {
                       $recipient = $row['email'];
                       $name = $row['name'];
            
    $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                <html><head>
                <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
                <meta name="generator" content="Adobe GoLive">
                <title>Glasshouse e-news</title>
                <style type="text/css">
                body {
                background-color:#FFFFFF;
                margin:0px;
                padding:0px;
                text-align:left;
                }
                
                h1 {
                font: bold 16px Verdana, Arial, Helvetica, sans-serif;
                color:#808080;
                padding: 10px;
                }
                
                .td_content {
                font: 11px Verdana, Arial, Helvetica, sans-serif;
                color: 000000;
                padding: 10px;
                }
                </style>
                </head>
                <body>
                '.stripslashes($body).'
                <table width="525" border="0" cellspacing="0" cellpadding="0">
                <tr><td><img src="http://www.domain.com/images/10x10_Transp.gif" alt="" width="15" height="15" border="0"></td></tr>
                <tr><td valign="top" bgcolor="gray">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr><td valign="top">
                <table width="100%" border="0" cellspacing="10" cellpadding="0">
                <tr><td><font size="-3" face="Verdana, Arial, Helvetica, sans-serif">To unsubscribe from this email communication, please <a href="http://www.domain.com/mailing_list.php?action=unsubscribe&email='.$recipient.'">click here</a></font></td></tr>
                </table>
                </td></tr>
                </table>
                </td></tr>
                </table>
                </body>
                </html>';
                
    mail($recipient, $subject, $message, $headers);
    $this->sent($newsletter_id);
    print $recipient ." Sent<br>";
    
    $x++;
    if($x == $hold) { // When $x is equal to $hold, a 3 sec delay will occur avoiding php to timeout
    sleep(3);
    $x = 0;
    }
    }
    }
[/code]


Thanks in advance

Rob

Share this post


Link to post
Share on other sites
hey man are you actually sending it through the php smtp that is listed in the .ini file as if they aint set that will couse a prob and also do you get any errors

Share this post


Link to post
Share on other sites
Hi,

Nope no errors at all. Its always worked fine, except for this specific client.

I sort of followed what you were saying, any ideas on how to fix it?

Cheers,

Share this post


Link to post
Share on other sites
[!--quoteo(post=364396:date=Apr 13 2006, 02:26 PM:name=robpicken)--][div class=\'quotetop\']QUOTE(robpicken @ Apr 13 2006, 02:26 PM) [snapback]364396[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Hi,

Nope no errors at all. Its always worked fine, except for this specific client.

I sort of followed what you were saying, any ideas on how to fix it?

Cheers,
[/quote]

if there is a prob wid the the smtp settings in the php.ini file you gotta locate the file look for the bit that says SMTP and make sure that is set correctly to an open smtp and that should be it

Share this post


Link to post
Share on other sites
I'll have to take a look and the smtp settings.

I've downloaded phpmailer so i'm going to implement that over the weekend as well, to see if that breaks through their MX server.

Cheers

Rob

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.