Jump to content

html mail problem


robpicken

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
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.