GithubHelp home page GithubHelp logo

e-dschungel / rssgoemail Goto Github PK

View Code? Open in Web Editor NEW
20.0 5.0 6.0 281 KB

rssgoemail is an RSS to Email script in PHP

PHP 88.80% Python 5.74% Shell 5.46%
cron-jobs rss php email email-sender database mysql mysql-database pdo php7 simplepie atom feed feed-reader

rssgoemail's Introduction

rssgoemail

rssgoemail is a script that watches multiple RSS (or Atom) feeds and sends out an email digest if a new entry is found. It is a fork of the script by Abdul Ibad which used to live at http://ibad.bebasbelanja.com. It uses SimplePie for RSS handling, PHPMailer for email sending and Symfony/Cache for caching.

Requirements

  • PHP > 7.2.5
  • a MySQL database
  • a cronjob

Installation

From Git

  • Clone this repo git clone https://github.com/e-dschungel/rssgoemail
  • Install dependencies using composer composer install --no-dev
  • Create database using config/rssgoemail.sql
  • Rename config/config.dist.php to config/config.php and edit it according to your needs, see below
  • Add a cronjob which accesses rssgoemail.php regularly

From ZIP file

  • Download rssgoemail.zip (NOT Source Code (zip) or Source Code (tar.gz)) from https://github.com/e-dschungel/rssgoemail/releases/latest
  • Extract and upload it to your webserver
  • Create database using config/rssgoemail.sql
  • Rename config/config.dist.php to config/config.php and edit it according to your needs, see below
  • Add a cronjob which accesses rssgoemail.php regularly

Configuration

variable description
$rge_config['dbHost'] hostname of the database, localhost is very common
$rge_config['dbUser'] user used to connect to the database
$rge_config['dbPass'] password used to connect to the database
$rge_config['dbBase'] name of the database
$rge_config['dbTable'] name of the table
$rge_config['notificationType'] sets the notification type: "summary" one mail for all new RSS items, or "perItem" for one mail per new RSS item
$rge_config['emailTo'] email adress of the recipient of the email digest, multiple recipients can be given separated by comma, e.g. $rge_config['emailTo'] = "[email protected], [email protected]";
$rge_config['emailFrom'] email adress shown as sender of the digest
$rge_config['emailSubject'] subject of the email digest, in perItem mode placeholders (see below) can be used
$rge_config['emailSubjectFeedErrorPerItem'] subject of mail containing feed errors (only used in perItem mode)
$rge_config['emailBody'] template for mail body, for placeholder see below, in summary mode this should end with an empty line as this is attached over and over to create the mail text
$rge_config['emailBackend'] can be "mail" or "smtp", "mail" uses sendmail as before, "smtp" uses SMTP. If "smtp" is used all SMTP variables must be set
$rge_config['errorInFeed'] warning which is shown when the feed contains errors
$rge_config['dateFormat'] format of date and time, formatting specifiers like PHP's date function
$rge_config['cacheDir'] cache dir, needs to be writeable
$rge_config['cacheTime'] cache time in seconds, during this time no changes from feeds are recognized as the cached version is used
$rge_config['feedUrls'] array with URLs of RSS or Atom feeds to be watched
$rge_config['SMTPHost'] SMTP hostname
$rge_config['SMTPAuth'] use SMTP authentication? true or false
$rge_config['SMTPUsername'] SMTP username
$rge_config['SMTPPassword'] SMTP password
$rge_config['SMTPSecurity'] type of SMTP security setting, can be "starttls" or "smtps"
$rge_config['SMTPPort'] SMTP port

Placeholder

placeholder description
##FEED_COPYRIGHT## copyright of the feed
##FEED_DESCRIPTION## description of the feed
##FEED_LANGUAGE## language of the feed
##FEED_LINK## language of the feed
##FEED_TITLE## title of the feed
##ITEM_AUTHOR_EMAIL## email address of the item author
##ITEM_AUTHOR_LINK## link to the item author
##ITEM_AUTHOR_NAME## name of the item author
##ITEM_COPYRIGHT## copyright of the item
##ITEM_CONTENT## content of the item, does not fall back to description if not given
##ITEM_DATE## date of the RSS item (in format given by $rge_config['dateFormat'])
##ITEM_DESCRIPTION## description of the item, does not fall back to content if not given
##ITEM_ENCLOSURE_LINK## URL of the media in enclosure tag
##ITEM_LINK## URL of the RSS item
##ITEM_TITLE## title of the RSS item

Changelog

Version 0.1

  • first public release (of this fork)

Version 0.2

  • upgrade to SimplePie 1.5
  • switch to PDO for database access to make script compatible to PHP 7
  • use SimplePie's internal hash functions (avoids duplicated emails)
  • fix for special characters in feed title

Version 0.2.1

  • decreased default cache time to 1800 seconds, improved documentation on cacheTime

Version 0.3

  • switch to PHPMailer to handle mail sending, this allows SMTP instead of PHPs mail function
  • notification type can be configured: "summary" one mail for all new RSS items, or "perItem" for one mail per new RSS item
  • mail body can be customized using placeholders
  • update to latest SimplePie 1.5.6
  • migration from older versions: add new configuration variables from config.dist.php to your config.php, although sane default values will be used

Version 0.3.1

  • added new placeholders ##FEED_COPYRIGHT##, ##FEED_DESCRIPTION##, ##FEED_LANGUAGE##, ##FEED_LINK##, ##ITEM_AUTHOR_EMAIL##, ##ITEM_AUTHOR_LINK##, ##ITEM_AUTHOR_NAME##, ##ITEM_COPYRIGHT##, ##ITEM_CONTENT##, ##ITEM_DESCRIPTION##, ##ITEM_ENCLOSURE_LINK##
  • update to PHPMailer 6.3.0

Version 0.3.2

  • cleanup release: no functional changes, only codingstyle improvements

Version 0.3.3

  • updated PHPMailer to 6.4.0

Version 0.3.4

  • avoid crashes if part of placeholder (like author or enclosure) is missing
  • fixed checking of config parameters

Version 0.3.5

  • updated PHPMailer to 6.4.1

Version 0.3.6

  • updated PHPMailer to 6.5.0

Version 0.3.7

  • updated PHPMailer to 6.5.1

Version 0.3.8

  • updated PHPMailer to 6.5.3

Version 0.3.9

  • updated SimplePie to 1.5.7

Version 0.3.10

  • updated SimplePie to 1.5.8

Version 0.3.11

  • updated PHPMailer to 6.5.4

Version 0.3.12

  • use PHPStan
  • fixed errors found by PHPStan
  • fixed issue in perItem mode
  • updated PHPMailer to 6.6.0

Version 0.3.13

  • update PHPMailer to 6.6.5
  • update SimplePie to 1.7.0

Version 0.4.0

  • update PHPMailer to 6.7.1
  • update SimplePie to 1.8.0
  • use Symfony/Cache for Caching
  • increase min required PHP version to 7.2.5 (due to SimplePie 1.8.0 and Symfony/Cache)

Version 0.4.1

  • update PHPMailer to 6.8.0
  • update Symfony/Cache to 5.4.21
  • update dev dependencies

Version 0.4.2

  • update PHPMailer to 6.8.1
  • update Symfony/Cache to 5.4.28
  • update dev dependencies

rssgoemail's People

Contributors

e-dschungel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

rssgoemail's Issues

Script always detects Facebook posts as new

Let me just say that what you created here is beautiful. It's simple and it works! I have encountered 1 problem though and I can't figure it out.

I initially set up Rssgoemail and I added 7 feeds to it. That's 4 for Twitter, 2 for Facebook and 1 for Instagram. I set up my cache at 25 minutes, and my Cron at 30 minutes. I also set the cache and cron for my RSS feeds at 30 minutes (I use FreshRSS for the feeds).

Everything worked perfectly. However, for some reason the script would always recognize the latest posts from my Facebook feeds as new, and send me 1 email per hour that there's updates, even though there weren't any.

See -
mmm

As soon as I removed the 2 Facebook feeds from Rssgoemail, these routine emails stopped arriving, and I only get emails now when my feeds actually have new updates on them.

All of my feeds are created using self-hosted FreshRSS, so I would imagine they all have the same structure. I tried finding a solution. Reducing/increasing cache and cron times, adding/removing feeds, but I can't figure it out and I don't know what to do. I'm not really super skillful at RSS and coding.

Any ideas why the Facebook posts are always being picked up as new every hour? Thank you ๐Ÿ˜ƒ

Adding new line separation in Body of email

Hello, I would like to know if there is a way to add new lines or separate the text in the body of the email.

Currently I am trying to put this to get each on a separate line and with some separation but it just displays the

$rge_config['emailBody'] = "##ITEM_TITLE##
##ITEM_DATE##

##ITEM_LINK##


##ITEM_CONTENT##
";

Is there some other way to do that or it is all one line no matter what I would do?

Thanks.

Compatibility with PHP 8

Hello, is the script compatible with PHP8? I updated my server to PHP 8 and the script no longer seems to run successfully.

I am running an older version and not the latest, but I'd just like to check before updating since if it isn't compatible with PHP8, I would hold off on updating since I did a lot of customization for our needs.

Please let me know. Thanks

E-Mail format + feed name in subject

Hi,

i'm not sure if this is the right place for these questions ...

I'm using your program and it works, but now i'd like to do some modifications, but i'm to stupid to change the code myself :)

  1. Question is solved in issue 4 ๐Ÿ‘
  2. Is it possible to change the format of the generated emails? At the moment Outlook displays it with Times New Roman 10.
  3. I have multiple feeds, is it possible to include the name of the feed into the subject?

Thanks in advanced and regards from Germany
Steffen

Not able to detect news in RSS-Feed

I currently testing this script to be able to send news from a specific feed via Mailman to a group of Users. But apparently, the script is not able to detect news on the feed. I run the script by a cron-job on a hourly base. The first run was successful, but since then no news are detected anymore, even the feed gets update nearly every 15 minutes...
If I run the script manually I get the message: "Nothing to send"
I am monitoring this feed: https://api.20min.ch/rss/view/1

Is there a bug in the script or is my configuration wrong?
config.zip

Does this work? Possible database table problem

This project seems to be exactly what I need, but I can't seem to get it to work. I'm kind of a noob with all this stuff by the way.

Let me know if this doesn't work for some reason, so that I can stop trying?

Assuming that it does work...

So I downloaded the file, uploaded it on my server (Hostgator), and created the database, and uploaded the rssgoemail.sql file, and set up the cron job. I also edited the config file to reflect my setup.

Now, the cron job seems to run correctly, but I don't get an email notification of my feed being updated (even though the feed has new content on it). I suspect it may have something to do with the sql database/table.

The reason I suspect this is because I would imagine the table would get populated after the first time Cron runs, so that it has something to compare to when it runs again to decide whether there are new items on the feed or not.

And here's my feed - https://ninomaluri.com/FreshRSS-master/p/i/?a=rss&hours=168

I hope you can help me. Thank you :)

Possibility to set mail format to HTML

Hi,

Could you please create a new boolean variable $rge_config['emailHTML'] that could easily be defined in the config.php file?

For now I modified the rssgoemail_functions.php file by setting $mail->isHTML(true); which works perfectly, but the value is automatically overwritten on every update.

This is very useful when the content of RSS feeds is formatted with HTML tags.

Thank you in advance and thank you for this wonderful tool!

Way to have only one RSS entry per email sent, and have the entry title display as the subject

Hello,

I am wondering if there is a way to have only one rss entry / article included per email, rather than several.

Also, if there is an easy way to have the title of the included RSS entry article display as the email subject line.

We use the script and run it every minute with a cron job, so ideally we just want one article linked per email rather than several. And for the article title to display in the subject.

If there's anyway to do this it would be appreciated.

I tried doing it myself but all I ended up with was a non working script.

Feed Error - cURL error 28

I am getting following error.

Feed Error
cURL error 28: Operation timed out after 10002 milliseconds with 0 bytes received    

Can not find anything work around.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.