النتائج 1 إلى 3 من 3

الموضوع: مساعدة في جعل الإرسال يتم من خلال smtp و ليس دالة mail

  1. #1
    عضو نشيط
    تاريخ التسجيل
    Mar 2008
    المشاركات
    155

    مساعدة في جعل الإرسال يتم من خلال smtp و ليس دالة mail



    السلام عليكم و رحمة الله

    وجدت سكربت يرسل Rss إلى Email
    لكن السكربت يستخدم دالة mail في الإرسال
    أريد منكم التعديل عليه ليرسل من خلال smtp

    كود السكربت
    كود PHP:
    <?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-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");
            }
        }
    ?>








  2. #2

  3. #3
    عضو نشيط
    تاريخ التسجيل
    Mar 2008
    المشاركات
    155


    الرجاء التعديل على الكود ووضعه جاهزا
    لأني لا أعرف الكثير عن الـ php










ضوابط المشاركة

  • لا تستطيع إضافة مواضيع جديدة
  • لا تستطيع الرد على المواضيع
  • لا تستطيع إرفاق ملفات
  • لا تستطيع تعديل مشاركاتك
  •  

أضف موقعك هنا| اخبار السيارات | حراج | شقق للايجار في الكويت | بيوت للبيع في الكويت | دليل الكويت العقاري | مقروء | شركة كشف تسربات المياه | شركة عزل اسطح بالرياض | عزل فوم بالرياض| عزل اسطح بالرياض | كشف تسربات المياة بالرياض | شركة عزل اسطح بالرياض