(MY ENGLISH IS NOT GOOD) I found a script that send rss to email and i am a beginner in php and i want some one make this script send from smtp (smtp.gmail.com) FOR ME PLEASE and THANKS in advance <?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('Content-Type: text/plain'); echo 'Feed: ' . $feed['link'] . "\r\n"; /** * 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}\r\n"; // 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 . "\r\n"); } } ?> PHP:
Take a look at the pear package and this article http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm