You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 536 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
How to allow HTML in the Newsletter

19.2. How to allow HTML in the Newsletter

Figure 19-3. Administration panel: Newsletter.

Administration panel: Newsletter.



If you want to use HTML, instead of only plain text in the Newsletter from the administration panel, you have to do the following:

Replace the function newsletter_send() in admin/modules/newsletter.php with:

function newsletter_send($title, $content) {
    global $user_prefix, $sitename, $dbi, $nukeurl, $adminmail;
    $send_html_messages = "yes";
    $from = $adminmail;
    $subject = "[$sitename Newsletter]: ".stripslashes($title)."";
    $content = stripslashes($content);
    $content = "$sitename "._NEWSLETTER."\n\n\n$content\n\n- 
$sitename "._STAFF."\n\n\n\n\n\n"._NLUNSUBSCRIBE."";
    $result = sql_query("select email from ".$user_prefix.
"_users where newsletter='1'", $dbi);
    while(list($email) = sql_fetch_row($result, $dbi)) {
        $xheaders = "From: " . $sitename . " <" . $adminmail . ">\n";
        $xheaders .= "X-Sender: <" . $adminmail . ">\n";
        $xheaders .= "X-Mailer: PHP\n"; // mailer
        $xheaders .= "X-Priority: 6\n"; // Urgent message!
        if ($send_html_messages == "yes") {
            $xheaders .= "Content-Type: text/html; 
charset=iso-8859-1\n"; // Mime type
        }
        mail("$email","$subject","$content",$xheaders);
    }
    Header("Location: admin.php?op=newsletter_sent");
} 

and the function massmail_send() with

function massmail_send($title, $content) {    
    global $user_prefix, $sitename, $dbi, $nukeurl, $adminmail;
    $send_html_messages = "yes";
    $from = $adminmail;
    $subject = "[$sitename]: $title";
    $content = stripslashes($content);
    $content = ""._FROM.": $sitename\n\n\n\n$content\n\n\n\n- 
    $sitename "._STAFF."\n\n\n\n"._MASSEMAILMSG."";
    $result = sql_query("select email from ".$user_prefix
    ."_users where uid != '1'", $dbi);
    while(list($email) = sql_fetch_row($result, $dbi)) {
        $xheaders = "From: " . $sitename . " <" . $adminmail . ">\n";
        $xheaders .= "X-Sender: <" . $adminmail . ">\n";
        $xheaders .= "X-Mailer: PHP\n"; // mailer
        $xheaders .= "X-Priority: 6\n"; // Urgent message!
        if ($send_html_messages == "yes") {
            $xheaders .= "Content-Type: text/html;
            charset=iso-8859-1\n"; // Mime type
        }
        mail("$email","$subject","$content",$xheaders);
    }
    Header("Location: admin.php?op=massmail_sent");
}    

The changes are in both functions the same: a flag, $send_html_messages, is checked and if set to "yes", the headers of the Newsletter mails (stored in the $xheaders variable) get an extra line for the MIME type:

Content-Type: text/html; charset=iso-8859-1

See also HTML Newsletter, but be warned that the code presented in that link, may not escape double quotes, probabbly due to an upgrade bug in the forums.

Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.194 Seconds - 408 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::