[Help] How to send HTML mail with php ?

Discussion in 'PHP' started by algerian, Oct 7, 2009.

  1. #1
    Hi,

    I want to change the format of mail to HTML in this script :

    <?php 
        /** 
        * o------------------------------------------------------------------------------o 
        * | This package is licensed under the Phpguru license. A quick summary is       | 
        * | that for commercial use, there is a small one-time licensing fee to pay. For | 
        * | registered charities and educational institutes there is a reduced license   | 
        * | fee available. You can read more  at:                                        | 
        * |                                                                              | 
        * |                  http://www.phpguru.org/static/license.html                  | 
        * o------------------------------------------------------------------------------o 
        * 
        * � Copyright 2008,2009 Richard Heyes 
        */ 
    
        /** 
        * Some RSS feeds to fetch. It uses a UNIX tmp dir which you will need to change if you're using it on Windows. 
        */ 
        $urls[] = 'http://www.phpguru.org/rss.php'; 
        $urls[] = 'http://www.planet-php.org/rss/'; 
    
        foreach ($urls as $url) { 
            $rss    = file_get_contents($url); 
            $xml    = new SimpleXMLElement($rss); 
            $cache  = '/tmp/rss_' . md5($url) . '.txt'; 
         
            /** 
            * Get the cache file. Could replace this with an "inRSSCache()" function 
            */ 
            $cache_contents = file_exists($cache) ? file_get_contents($cache) : ''; 
         
            /** 
            * Some stuff to use in the email 
            */ 
            $feed['title']        = (string)$xml->channel[0]->title; 
            $feed['link']         = (string)$xml->channel[0]->link; 
            $feed['description']  = trim((string)$xml->channel[0]->description); 
    
            /** 
            * Print the data 
            */ 
            header('(anti-spam-(anti-spam-content-type:)) text/plain'); 
            echo 'Feed: ' . $feed['link'] . "rn"; 
    
            /** 
            * Loop through all the items in the feed 
            */ 
            foreach ($xml->channel->item as $item) { 
                $url = (string)$item->link; 
                 
                if (strpos($cache_contents, $url) !== false) { 
                    continue; 
                } 
    
                echo "      {$url}rn"; 
                 
                // The data from the feed 
                $title       = (string)$item->title; 
                $link        = $url; 
                $pubDate     = (string)$item->pubDate; 
                $description = ltrim($item->description); 
    
                $to   = 'postmaster@domain.com'; // Put your email address here 
                $mail = <<<END 
    Title: {$title} 
      URL: {$url} 
     Date: {$pubDate} 
      
    {$description} 
    END; 
                mail($to, '[RSS] ' . $title, $mail, "From: {$feed['title']}"); // Might want to put a valid From: address here 
                                         
                // Store the URL in our tmp file for recording which items we've seen 
                fwrite(fopen($cache, 'a'), $url . "rn"); 
            } 
        } 
    ?>
    PHP:
    Can someone do it for me please !

    thanks.
     
    algerian, Oct 7, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    premiumscripts, Oct 7, 2009 IP
  3. algerian

    algerian Guest

    Messages:
    8
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for your reply ,but i want someone change the script .
     
    algerian, Oct 7, 2009 IP