Giter Site home page Giter Site logo

wking / rss2email Goto Github PK

View Code? Open in Web Editor NEW

This project forked from turbodog/rss2email

266.0 21.0 48.0 1.14 MB

open-source tool for Windows, Mac OS and UNIX for getting news from RSS feeds in email

Home Page: http://pypi.python.org/pypi/rss2email/

License: GNU General Public License v2.0

Python 92.06% Groff 7.87% Batchfile 0.07%

rss2email's Introduction

Getting Started With rss2email

We highly recommend that you subscribe to the rss2email project feed so you can keep up to date with the latest version, bugfixes and features:

http://rss.gmane.org/gmane.mail.rss2email

Installing rss2email

Packages

A quick way to get rss2email going is using pre-made packages. There are releases for Debian, Ubuntu, Fedora, openSUSE, Gentoo, and NetBSD.

Installing by hand

Requirements

Before you install rss2email, you'll need to make sure that a few things are in place.

  1. Ensure that a version of Python ≥3.2 is installed.
  2. Install the required Python packages.
  3. Figure out how you are going to send outgoing email. You have two options here: either use an STMP server or a local sendmail program. So,
    • determine your outgoing email server's SMTP address, or
    • install sendmail (or a compatible replacement like postfix).

Download

Download the latest rss2email source and unpack it. You can choose from several equivalent formats.

  1. A .zip file (suggested for Microsoft Windows users):

    $ wget https://github.com/wking/rss2email/archive/v3.9.zip
    $ unzip rss2email-*.zip
  2. A .tar.gz file (suggested for everyone else):

    $ wget https://github.com/wking/rss2email/archive/v3.9.tar.gz
    $ tar xvf rss2email*.tar.gz
  3. A Git checkout (suggested for developers):

    $ git clone git://github.com/wking/rss2email.git

Install

From the unpacked directory, run:

$ python setup.py install

You can pass all the usual options to the install command, including --user. If you don't want to install rss2email, you can also run r2e directly from the source directory.

Upgrading to a new version

Just repeat the installation procedure for the new source package. If your config file and data file were in the old source directory, move them over to the new source directory. If the config and data files were in another directory (e.g. ~/.config and ~/.local/share), there is no need to move them.

Using rss2email

Create a new feed database to send updates to your email address:

This command will create a configuration file ($XDG_CONFIG_HOME/rss2email.cfs by default) and a feed database ($XDG_DATA_HOME/rss2email.json by default). If you'd rather those files were stored in other locations, use the --config and --data options. XDG_CONFIG_HOME defaults to $HOME/.config and XDG_DATA_HOME defaults to $HOME/.local/share.

You should edit the default configuration file now to adjust rss2email for your local system. Unless you've installed a local sendmail-equivalent, you'll need to edit the SMTP options.

Subscribe to some feeds:

$ r2e add rss2email http://rss.gmane.org/gmane.mail.rss2email

That's the feed to be notified when there's a new version of rss2email. Repeat this for each feed you want to subscribe to.

When you run rss2email, it emails you about every story it hasn't seen before. But the first time you run it, that will be every story. To avoid this, you can ask rss2email not to send you any stories the first time you run it:

r2e run --no-send

Then later, you can ask it to email you new stories:

r2e run

Customizing rss2email

There are a number of options, described in full in rss2email/config.py, to customize the way rss2email behaves. If you want to change something, edit the the configuration file that was created by r2e new.

For example, if you want to receive HTML mail, instead of having entries converted to plain text:

html-mail = True

To be notified every time a post changes, instead of just when it's first posted (see also trust-link, described in rss2email/config.py):

trust-guid = True

And to make the emails look as if they were sent when the item was posted:

date-header = True

If you get an error message Sender domain must exist, add the following to your configuration file:

from = [email protected]
force-from = True

You can make the email address whatever you want, but your mail server requires that the yoursite.com part actually exists.

You can also add custom filters, see the example and documentation in rss2email/post_process/prettify.py for more information.

SMTP

By default, rss2email uses sendmail (or an equivalent) to send outgoing email. If you don't have such a program installed, or simply prefer to use SMTP directly, edit the configuration file and fill in your outoing email server's details:

[DEFAULT]
...
use-smtp = True
smtp-server = smtp.example.net:587
smtp-auth = False
...

If your server requires you to login, change smtp-auth = False to smtp-auth = True and enter your email username and password:

smtp-auth = True
smtp-username = username
smtp-password = password

If your server requires an TLS/SSL connection (SMTPS), change smtp-ssl = False to smtp-ssl = True. If your server does not require a SMTPS connection but you request authentication, rss2email will use STARTTLS to encrypt the connection before sending your login credentials to the server.

Automating rss2email

More than likely you will want rss2email to run automatically at a regular interval. Under Windows this is can be easily accomplished using the Windows Task Scheduler. This site has a nice tutorial on it. Just select r2e.bat as the program to run. Once you've created the task, double click on it in the task list and change the Run entry so that run comes after r2e.bat. For example, if you installed rss2email in the C:\rss2email directory, then you would change the Run entry from C:\rss2email\r2e.bat to C:\rss2email\r2e.bat run.

On Unix/Linux systems, you should add a cron job that runs r2e. For example, run r2e every night (at 1:23 am) with:

23 1 * * * r2e run

Development

User discussion and development take place on the rss2email mailing list at [email protected]. Everyone is welcome to post bug reports, feature requests, comments, and patches. To subscribe to the list, send an email to [email protected]. The mailing list archives are available on Gmane.

rss2email's People

Contributors

alienacorn avatar cybe avatar eelis avatar emillon avatar iu-guest avatar jlmuir avatar jwilk avatar jzombi avatar punchagan avatar thiagoc avatar turbodog avatar untitaker avatar wking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rss2email's Issues

Upgrading to 3.8 deleted my $XDG_DATA_HOME/rss2email.json ?

I am not entirely sure about this, but I am putting it here in case other people have the same problem and want to add on. Sorry for the lack of details about the problem. I know that this isn't exactly a reproducible bug report.

I upgraded from, I think, Ubuntu Precise 12.04, which has version 1:2.71-0.1 to Ubuntu Utopic 14.10, which has version 1:3.8-1.

My upgrade was kind of rocky, I kept getting disconnected from the server and had to do do-release-upgrade three or four times. After the upgrade and the reboot, my r2e list command returns no feeds. The rss2email.json file looks like this:

u@h:~/.local/share$ cat rss2email.json 
{
  "feeds": [],
  "version": 2
}

I never looked at the file before, but I imagine it had lots of contents because I had 100 or 200 feeds added.

Is there any way to recover, like a backup file automatically generated somewhere? I will try to see if my VPS had backups turned on, since that might be a viable recovery plan too.

growing rss2email.json

Hi,

I experience a growing rss2email.json. It seems that r2e stores all ID of feeds entries without deleting them. My guess is that it is not necessary to keep seen ID's older than the number of available entries in the feed. Is there a way to sanitize this file?

Thanks.

Something weird in the manpage...

rpmlint finds this “error” on manpage:

rss2email.noarch: W: manual-page-warning /usr/share/man/man1/r2e.1.gz 128:
warning: macro `..' not defined
This man page may contain problems that can cause it not to be formatted as
intended.

Does it make any sense?

add support for plain SMTP

The new options for SMTP require either SSL or startTLS. How to have a good old plain SMTP connection without SSL and starttls?

Can't get r2e to work in Amazon EC2 instance

Hi!

I tried to configure r2e to send me and my teammates productions crashs loged in a feed running in an Amazon E2C instance, but no emails is received, no error message is returned and I am not able to find a log to troubleshoot the problem.

I am using a gmail SMTP account and have the same config running successfuly in a local staging server.

I don't think this is an issue in r2e, but maybe a common misstep some of you guys can point out?

I hope you can help me in this one. Thanks in advance!

Broken relative links in HTML

Although the use of relative links in feed is discouraged, there're some sites still exporting relative links without the use of xml:base in there feed, which implies the url of the feed itself, is used as the base url.

However, when rss2email converts an entry to HTML, it just copy the entries[i].summary(which has some relative links) or something to the HTML <body>, without taking care of the links, making the mail I received contains broken links.

To get rid of this, we only have to add <base href="http://example.com/atom.xml"> to the beginning of the <head> in the HTML

BTW, it seems that rss2email is not handling xml:base well either(xml:base is not support in HTML). But since it's quite rare, shouldn't be a big problem.

imap ssl error

username = config.get(section, 'imap-username')
password = config.get(section, 'imap-password')

try:
if not ssl: <---- seemd error
imap.starttls()
imap.login(username, password)

except KeyboardInterrupt:

r2e -h: missing options

Hi,

There are missing options in the help message.
Ex:

  • r2e run 3 # run a specific feed
  • r2e run --no-send

and maybe others...

Thanks.

Fails on non-ascii names in emails

Hello,

Neither sendmail nor SMTP mode can handle email addresses with non-ascii characters. For a reliable test case, check out Planet Debian; Michal Čihař is a frequent contributor.
(http://planet.debian.org/rss20.xml)

Using sendmail, a command like this is generated:
/usr/sbin/sendmail -f '"Planet Debian: Michal Čihař" [email protected]'
which causes sendmail to exit with an error.

Using SMTP, generator.py attempts to force the email to be encoded in ascii:
Traceback (most recent call last):
File "/home/ross/bin/r2e", line 5, in
rss2email.main.run()
File "/home/ross/.local/lib/python3.2/site-packages/rss2email/main.py", line 163, in run
args.func(feeds=feeds, args=args)
File "/home/ross/.local/lib/python3.2/site-packages/rss2email/command.py", line 61, in run
feed.run(send=args.send)
File "/home/ross/.local/lib/python3.2/site-packages/rss2email/feed.py", line 783, in run
self._send(sender=sender, message=message)
File "/home/ross/.local/lib/python3.2/site-packages/rss2email/feed.py", line 762, in _send
config=self.config, section=section)
File "/home/ross/.local/lib/python3.2/site-packages/rss2email/email.py", line 304, in send
smtp_send(sender, recipient, message)
File "/home/ross/.local/lib/python3.2/site-packages/rss2email/email.py", line 164, in smtp_send
smtp.send_message(message, sender, [recipient])
File "/usr/lib/python3.2/smtplib.py", line 812, in send_message
g.flatten(msg_copy, linesep='\r\n')
File "/usr/lib/python3.2/email/generator.py", line 91, in flatten
self._write(msg)
File "/usr/lib/python3.2/email/generator.py", line 137, in _write
self._dispatch(msg)
File "/usr/lib/python3.2/email/generator.py", line 163, in _dispatch
meth(msg)
File "/usr/lib/python3.2/email/generator.py", line 398, in _handle_text
super(BytesGenerator,self)._handle_text(msg)
File "/usr/lib/python3.2/email/generator.py", line 201, in _handle_text
self.write(payload)
File "/usr/lib/python3.2/email/generator.py", line 357, in write
self._fp.write(s.encode('ascii', 'surrogateescape'))
UnicodeEncodeError: 'ascii' codec can't encode character '\u010c' in position 181: ordinal not in range(128)

Ross

feed identifier in mail headers

I'd love if rss2email put the feed identifier (that is, the name you put between square brackets in the configuration file) somewhere into mail headers.
This would allow me to greatly simplify my mail filters.

_os.rename() does not work on Windows

It gives error that file already exists (I google and found that this is expected behavior for Windows. I se Windows 7). It is in feeds.py line 352 and a little bit down. I did quick and dirty fixes:

    try: 
            _os.remove(self.configfiles[-1]) 
    except: 
            pass
    _os.rename(tmpfile, self.configfiles[-1])

Changes to smtp config options and dropping SSLv3.

As per instructions one has to use use-smtp = true to use smtp which doesn't seem to be valid anymore. It resulted in extra configuration key: use-smtp. I changed email-protocol = smtp to see if it works but it gave following errors.

could not connect to mail server smtp.gmail.com:465
cause: [SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:598)
reason: TLSV1_ALERT_DECODE_ERROR
could not connect to mail server smtp.gmail.com:465
cause: [SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:598)
reason: TLSV1_ALERT_DECODE_ERROR
could not connect to mail server smtp.gmail.com:465
cause: [SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:598)
reason: TLSV1_ALERT_DECODE_ERROR

Also the default protocol for smtp auth is SSLv3. Are folks still using SSLv3 after POODLE.

PS:- The older version of rss2email config had all options explained in the config file which was very helpful.

### Options for configuring rss2email ###

# The email address messages are from by default:
DEFAULT_FROM = "[email protected]"

#1: Send text/html messages when possible.
#0: Convert HTML to plain text.
HTML_MAIL = 1

#1: Only use the DEFAULT_FROM address.
#0: Use the email address specified by the feed, when possible.
FORCE_FROM = 0

#1: Receive one email per post.
#0: Receive an email every time a post changes.
TRUST_GUID = 1

#1: Generate Date header based on item's date, when possible.
#0: Generate Date header based on time sent.
DATE_HEADER = 0

# A tuple consisting of some combination of
# ('issued', 'created', 'modified', 'expired')
# expressing ordered list of preference in dates 
# to use for the Date header of the email.
DATE_HEADER_ORDER = ('modified', 'issued', 'created')

grouping of feeds

I have many feeds, around 30 - 40. With rss2email, all get added straight. But there is no categorization.

I'd like to fetch a group of feeds at a more frequent interval, than others which I don't find polling once a day. How can this be achieved with rss2email ?

Deletes config when disk is full

Hello,

I ran r2e run with a full disk, and I had this error message:

OSError: [Errno 28] No space left on device

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/r2e", line 5, in <module>
    rss2email.main.run()
  File "/usr/lib/python3/dist-packages/rss2email/main.py", line 163, in run
    args.func(feeds=feeds, args=args)
  File "/usr/lib/python3/dist-packages/rss2email/command.py", line 65, in run
    feeds.save()
  File "/usr/lib/python3/dist-packages/rss2email/feeds.py", line 348, in save
    self.config.write(f)
OSError: [Errno 28] No space left on device

But after this, it only outputs "no target email address has been defined". It turns out that the config file has been overwritten with an incomplete one. I restored from backup and the diff is:

diff -Nru a/rss2email.cfg b/rss2email.cfg
--- a/rss2email.cfg     2013-09-24 11:24:56.000000000 +0200
+++ b/rss2email.cfg     2013-09-26 10:50:23.000000000 +0200
@@ -4,7 +4,7 @@
 force-from = False
 use-publisher-email = False
 friendly-name = True
-to = $DEFAULT_TO 
+to = 
 proxy =
 feed-timeout = 60
 active = True
@@ -74,8 +74,6 @@
 verbose = warning

 [feed.$NAME_1]
-url = $URL_1 

 [feed.$NAME_2]
-url = $URL_2

(there is no relevant difference on rss2email.json)

I'm a bit puzzled about how this could happen (I expected the file to be truncated).

A solution I see is to write to a temporary file in Feeds.save and then atomically move it to its destination. Also, it may be possible to detect when it's necessary to save (I'm actually surprised that run can alter rss2email.cfg).

Thanks

Replace json?

Hi @wking and others.

As explained here: kurtmckee/feedparser#44 i made some investigations about performances and CPU consumption. I saw somebody complaining on the web about large CPU consumptions, and I have similar problems too.

In addition to what I reported above and the small enhancement I tried to make, it appears that a lot of cpu is used on save functions.

File: /home/fr/github/rss2email/rss2email/feeds.py
Function: _save_feeds at line 357
   340                                               @profile
   341                                               def save(self):
   342         1          172    172.0      0.0          dst_config_file = _os.path.realpath(self.configfiles[-1])
   343         1           27     27.0      0.0          _LOG.debug('save feed configuration to {}'.format(dst_config_file))
   344       110          335      3.0      0.0          for feed in self:
   345       109       365121   3349.7     14.2              feed.save_to_config()
   346         1           34     34.0      0.0          dirname = _os.path.dirname(dst_config_file)
   347         1           40     40.0      0.0          if dirname and not _os.path.isdir(dirname):
   348                                                       _os.makedirs(dirname, mode=0o700, exist_ok=True)
   349         1            3      3.0      0.0          tmpfile = dst_config_file + '.tmp'
   350         1          162    162.0      0.0          with open(tmpfile, 'w') as f:
   351         1         2953   2953.0      0.1              self.config.write(f)
   352         1           40     40.0      0.0              f.flush()
   353         1       123012 123012.0      4.8              _os.fsync(f.fileno())
   354         1          206    206.0      0.0          _os.rename(tmpfile, dst_config_file)
   355         1      2087550 2087550.0     80.9          self._save_feeds()

File: /home/fr/github/rss2email/rss2email/feeds.py
Function: _save_feed_states at line 373

Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
   373                                               @profile
   374                                               def _save_feed_states(self, feeds, stream):
   375         1           10     10.0      0.0          _json.dump(
   376         1            7      7.0      0.0              {'version': self.datafile_version,
   377         1         2910   2910.0      0.1               'feeds': list(feed.get_state() for feed in feeds),
   378                                                        },
   379         1            4      4.0      0.0              stream,
   380         1            9      9.0      0.0              indent=2,
   381         1      1939815 1939815.0     99.8              separators=(',', ': '),
   382                                                       )
   383         1           15     15.0      0.0          stream.write('\n')

Is there any particular reason to choose json? I guess, but I've not tested that a binary format would be more efficient. I don't think anybody is going to read the json file anyway.
I think there is room for optimization here.

Any though?

Please add documentation for using rss2email with smtp/gmail

email-protocol = sendmail
sendmail = /usr/sbin/sendmail
smtp-auth = True
smtp-username = username
smtp-password = password
smtp-server = smtp.domain.org:25
smtp-ssl = False
smtp-ssl-protocol = SSLv3

Could anyone please help me setup smtp using a gmail account? What is the smtp-ssl-protocol am I supposed to use?

duplicate feed name duing opml import

opmlimport fails when on the first time a duplicate feed name is detected. I had to search and remove the offending feed and rerun the import few times.
I would suggest to either:

  • list the name and URL of all the offending feeds
  • ignore them and go on with the import
  • even better, ask the user interactively to skip or import with a different name any duplicate feed

Thanks!

Suggestion: categories

Able to add a category to each feed, that will appear in the email subject. so that you can setup your email filter to sort them into folders on arrival.

Allow embedding of images

With the current code, images are src'd from the original web page, so when the user's email client loads the feed item, it still has to wait for images to load from the remote server. Furthermore, if there is no internet connection, the images won't load.

It would be nice to have an option for rss2email to download the images from posts when it fetches them, convert them to a DATA URI (http://www.websiteoptimization.com/speed/tweak/inline-images/) and embed them on every email

"looks like HTML" warning broken

In rss2email/feed.py there's this code to warn when the server sent you HTML:

http_headers = parsed.get('headers', {})
...
if 'html' in http_headers.get('content-type', 'rss'):
    _LOG.warning('looks like HTML: {}'.format(self))
    warned = True

But at least with feedparser v5.1.3, http_headers is a normal dict with keys that were not lower-cased. So this check won't trigger most of the time.

error executing r2e

Hi,
I download r2e version. I've installed with digest=true but when I execute r2e it gives me:

r2e
Traceback (most recent call last):
File "/usr/local/bin/r2e", line 3, in
import rss2email.main
File "/usr/local/lib/python3.2/site-packages/rss2email/main.py", line 27, in
from . import command as _command
File "/usr/local/lib/python3.2/site-packages/rss2email/command.py", line 26, in
from . import error as _error
File "/usr/local/lib/python3.2/site-packages/rss2email/error.py", line 27, in
import feedparser as _feedparser
ImportError: No module named feedparser

Please any help?

Setting verbosity in config file does not work

As noted in this bug, the verbosity in the configuration file is ignored.

If I understand it correctly, one problem is that verbosity from args is set quite early (in run) and configuration is loaded only later (in Feed.__init__?), so the conffile setting would override it.

Thanks

email.errors.HeaderParseError: header value appears to contain an embedded header

Getting the following error on this feed:

http://sarahcandersen.com/rss

Traceback (most recent call last):
File "bin/r2e", line 5, in
rss2email.main.run()
File "/home/craig/.virtualenvs/rss2email3/lib/python3.4/site-packages/rss2email/main.py", line 163, in run
args.func(feeds=feeds, args=args)
File "/home/craig/.virtualenvs/rss2email3/lib/python3.4/site-packages/rss2email/command.py", line 62, in run
feed.run(send=args.send)
File "/home/craig/.virtualenvs/rss2email3/lib/python3.4/site-packages/rss2email/feed.py", line 842, in run
for (guid, id_, sender, message) in self._process(parsed):
File "/home/craig/.virtualenvs/rss2email3/lib/python3.4/site-packages/rss2email/feed.py", line 357, in _process
processed = self._process_entry(parsed=parsed, entry=entry)
File "/home/craig/.virtualenvs/rss2email3/lib/python3.4/site-packages/rss2email/feed.py", line 502, in _process_entry
section=self.section)
File "/home/craig/.virtualenvs/rss2email3/lib/python3.4/site-packages/rss2email/email.py", line 119, in get_message
sender_name = str(_Header(sender_name, sender_encoding).encode())
File "/usr/lib/python3.4/email/header.py", line 393, in encode
"an embedded header: {!r}".format(value))
email.errors.HeaderParseError: header value appears to contain an embedded header: "Sarah's\nScribbles: "

Lot's of sendmail entries in journalctl even when using smtp

I use smtp to send email and yet I see a lot of sendmail entries in the log.

[sudhir@fedora ~]$ journalctl -b | grep crond
Jan 02 20:13:19 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=crond comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Jan 02 20:13:19 fedora crond[1233]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 84% if used.)
Jan 02 20:13:20 fedora crond[1233]: (CRON) INFO (running with inotify support)
Jan 02 21:00:01 fedora audit[7168]: USER_ACCT pid=7168 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_access,pam_unix,pam_localuser acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 21:00:01 fedora audit[7168]: CRED_ACQ pid=7168 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 21:00:01 fedora audit[7168]: USER_START pid=7168 uid=0 auid=1000 ses=2 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 21:00:01 fedora audit[7168]: CRED_REFR pid=7168 uid=0 auid=1000 ses=2 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 21:01:12 fedora audit[7168]: CRED_DISP pid=7168 uid=0 auid=1000 ses=2 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 21:01:12 fedora audit[7168]: USER_END pid=7168 uid=0 auid=1000 ses=2 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 21:30:01 fedora audit[8934]: USER_ACCT pid=8934 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_access,pam_unix,pam_localuser acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 21:30:01 fedora audit[8934]: CRED_ACQ pid=8934 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 21:30:01 fedora audit[8934]: USER_START pid=8934 uid=0 auid=1000 ses=3 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 21:30:01 fedora audit[8934]: CRED_REFR pid=8934 uid=0 auid=1000 ses=3 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 21:31:11 fedora audit[8934]: CRED_DISP pid=8934 uid=0 auid=1000 ses=3 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 21:31:11 fedora audit[8934]: USER_END pid=8934 uid=0 auid=1000 ses=3 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:00:01 fedora audit[10494]: USER_ACCT pid=10494 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_access,pam_unix,pam_localuser acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:00:01 fedora audit[10494]: CRED_ACQ pid=10494 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:00:01 fedora audit[10494]: USER_START pid=10494 uid=0 auid=1000 ses=4 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:00:01 fedora audit[10494]: CRED_REFR pid=10494 uid=0 auid=1000 ses=4 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:01:11 fedora audit[10494]: CRED_DISP pid=10494 uid=0 auid=1000 ses=4 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:01:11 fedora audit[10494]: USER_END pid=10494 uid=0 auid=1000 ses=4 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:30:01 fedora audit[13526]: USER_ACCT pid=13526 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_access,pam_unix,pam_localuser acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:30:01 fedora audit[13526]: CRED_ACQ pid=13526 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:30:01 fedora audit[13526]: USER_START pid=13526 uid=0 auid=1000 ses=5 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:30:01 fedora audit[13526]: CRED_REFR pid=13526 uid=0 auid=1000 ses=5 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:31:11 fedora audit[13526]: CRED_DISP pid=13526 uid=0 auid=1000 ses=5 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 22:31:11 fedora audit[13526]: USER_END pid=13526 uid=0 auid=1000 ses=5 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 23:00:01 fedora audit[15296]: USER_ACCT pid=15296 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:accounting grantors=pam_access,pam_unix,pam_localuser acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 23:00:01 fedora audit[15296]: CRED_ACQ pid=15296 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 23:00:01 fedora audit[15296]: USER_START pid=15296 uid=0 auid=1000 ses=6 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_open grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 23:00:01 fedora audit[15296]: CRED_REFR pid=15296 uid=0 auid=1000 ses=6 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 23:01:16 fedora audit[15296]: CRED_DISP pid=15296 uid=0 auid=1000 ses=6 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:setcred grantors=pam_env,pam_unix acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
Jan 02 23:01:16 fedora audit[15296]: USER_END pid=15296 uid=0 auid=1000 ses=6 subj=system_u:system_r:crond_t:s0-s0:c0.c1023 msg='op=PAM:session_close grantors=pam_loginuid,pam_keyinit,pam_limits,pam_systemd acct="sudhir" exe="/usr/sbin/crond" hostname=? addr=? terminal=cron res=success'
[sudhir@fedora ~]$ journalctl -b | grep sendmail
Jan 02 21:00:11 fedora sendmail[7216]: My unqualified host name (fedora) unknown; sleeping for retry
Jan 02 21:01:11 fedora sendmail[7216]: unable to qualify my own domain name (fedora) -- using short name
Jan 02 21:01:12 fedora sendmail[7216]: u02FVC8x007216: from=sudhir, size=598, class=-60, nrcpts=1, msgid=<201601021531.u02FVC8x007216@fedora>, relay=sudhir@localhost
Jan 02 21:01:12 fedora sendmail[7216]: u02FVC8x007216: to=sudhir, ctladdr=sudhir (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=138598, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Jan 02 21:30:11 fedora sendmail[8978]: My unqualified host name (fedora) unknown; sleeping for retry
Jan 02 21:31:11 fedora sendmail[8978]: unable to qualify my own domain name (fedora) -- using short name
Jan 02 21:31:11 fedora sendmail[8978]: u02G1Brd008978: from=sudhir, size=598, class=-60, nrcpts=1, msgid=<201601021601.u02G1Brd008978@fedora>, relay=sudhir@localhost
Jan 02 21:31:11 fedora sendmail[8978]: u02G1Brd008978: to=sudhir, ctladdr=sudhir (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=138598, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Jan 02 22:00:11 fedora sendmail[10539]: My unqualified host name (fedora) unknown; sleeping for retry
Jan 02 22:01:11 fedora sendmail[10539]: unable to qualify my own domain name (fedora) -- using short name
Jan 02 22:01:11 fedora sendmail[10539]: u02GVBMb010539: from=sudhir, size=598, class=-60, nrcpts=1, msgid=<201601021631.u02GVBMb010539@fedora>, relay=sudhir@localhost
Jan 02 22:01:11 fedora sendmail[10539]: u02GVBMb010539: to=sudhir, ctladdr=sudhir (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=138598, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Jan 02 22:30:11 fedora sendmail[13570]: My unqualified host name (fedora) unknown; sleeping for retry
Jan 02 22:31:11 fedora sendmail[13570]: unable to qualify my own domain name (fedora) -- using short name
Jan 02 22:31:11 fedora sendmail[13570]: u02H1Bmi013570: from=sudhir, size=598, class=-60, nrcpts=1, msgid=<201601021701.u02H1Bmi013570@fedora>, relay=sudhir@localhost
Jan 02 22:31:11 fedora sendmail[13570]: u02H1Bmi013570: to=sudhir, ctladdr=sudhir (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=138598, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Jan 02 23:00:16 fedora sendmail[15344]: My unqualified host name (fedora) unknown; sleeping for retry
Jan 02 23:01:16 fedora sendmail[15344]: unable to qualify my own domain name (fedora) -- using short name
Jan 02 23:01:16 fedora sendmail[15344]: u02HVGxW015344: from=sudhir, size=598, class=-60, nrcpts=1, msgid=<201601021731.u02HVGxW015344@fedora>, relay=sudhir@localhost
Jan 02 23:01:16 fedora sendmail[15344]: u02HVGxW015344: to=sudhir, ctladdr=sudhir (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=138598, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]

proxy and https feed

Hi there,

I'm a happy user of rss2email, so first thank you for the great work!

Recently I had a small issue with a feed which is apparently available only as https (this one: https://theintercept.com/feed/?rss)

I thought that this might be related to the fact that I'm using rss2email behind a proxy. I have the PROXY variable set in the config and it works for all the other feeds, but I was wondering if maybe rss2email doesn't use the http proxy for an https address?

Disclaimer: my skills in network-related things being close to zero, there's a real possibility that I'm completely wrong and missed something obvious!

Best,
Erwan

OPML import: Normalize invalid name instead of raising 'invalid feed name "%s"'

I just tried to import the subscription.xml from my takeout of google reader.
And the importer fails on quite all names with "special" characters in it. (spaces, ':', accentuated letters)

I suggest to change the behavior when importing from an opml file, so that the parser normalize the name by converting special characters to valid ones for rss2email.

Option to fetch whole referenced article

Most RSS feeds only include a teaser and not the whole article, which is a shame as I'd love to read the whole article right there.

How about an option to make r2e go out and fetch the referenced page?

Bonus points for a per-feed regexp to turn the reference URL (which usually just opens page 1) into e.g. the print version (all on one page).

Thanks,
martin

not well-formed (invalid token) breaks some feeds

matej@luther: ~$ r2e run
sax parsing error: <unknown>:22:4: mismatched tag: google-alert-xep-0027 (http://www.google.com/reader/about/ -> [email protected])
HTTP status 500 fetching feed jwildebo (http://jan.wildeboer.net/feed/ -> [email protected])
sax parsing error: <unknown>:140:937: not well-formed (invalid token): dorothygreco (http://www.dorothygreco.com/feed/ -> [email protected])
sax parsing error: <unknown>:140:937: not well-formed (invalid token): dorothygreco_mk (http://www.dorothygreco.com/feed/ -> [email protected])
sax parsing error: <unknown>:29:19: undefined entity: postmodernconserv (http://www.firstthings.com/rss/blogs/firstthoughts -> [email protected])

This happens to me while running r2e run with be376a6

The resulting emails for these feeds are sent, but they are with empty body.

ENH: add option to remove URL redirection.

Hi,

A enhancement I would like to see in rss2email.
Some websites (eg planets) are using redirections to do stats or whatever. I would be nice to remove such redirection before writing the email (with an option).

An example:

myurl = 'http://www.planet-libre.org/index.php?post_id=14825&go=external'
urllib.request.urlopen(myurl).geturl()
# 'http://la-vache-libre.org/rss-bridge-par-sebsauvage/'

I guess it can be added there in feed._get_entry_link().

Thanks!

Invalid MAIL FROM when using sendmail

I'm runnig rss2email version 3.8 from debian jessie.

my mailserver is receiving a line like this:

MAIL FROM:<"foobar <abc>" <foo@bar>>

I've setup r2e to invoke sendmail. Using smtp fixes this issue.

I haven't checked master for this yet.

Making rss2email responsive for smaller screens

When I view rss2email email's in my inbox some of the images are super large which doesn't look great in smaller screens. It would be great if the emails sent from rss2email can be made responsive.

[question] How can I add a customize field before send mail?

Before send mail, UTF-8 char will be encode with base64, which is difficult filted by
procmail.

I want to add a field: X-Subject-Pinyin, which can be generate from Subject fields, for example:

Subject:  hello, 你好

generate a field:

X-Subject-Pinyin:  hello nihao

Now I hack the rss2email source to get this feature ,
Is is possible using a post hook function?

SSL connection broken

The SSL connection for SMTP seems broken. Here is the message from the log:

cause: [SSL: TLSV1_ALERT_DECODE_ERROR] tlsv1 alert decode error (_ssl.c:598)
reason: TLSV1_ALERT_DECODE_ERROR

Related to #48

UnicodeEncodeError: 'ascii' codec can't encode character '\xfc' in position 133: ordinal not in range(128)

Hi,

I am running Python3.2 on Ubuntu and getting the below error after running 'r2e run'. The feed that I am trying to pull is: http://feeds.theguardian.com/theguardian/uk/rss

Would greatly appreciate any help on fixing this.

Thanks

File "/userdirectory/rss2email-3.5/r2e", line 5, in
rss2email.main.run()
File "/userdirectory/rss2email-3.5/rss2email/main.py", line 163, in run
args.func(feeds=feeds, args=args)
File "/userdirectory/rss2email-3.5/rss2email/command.py", line 61, in run
feed.run(send=args.send)
File "/userdirectory/rss2email-3.5/rss2email/feed.py", line 812, in run
self._send(sender=sender, message=message)
File "/userdirectory/rss2email-3.5/rss2email/feed.py", line 782, in _send
config=self.config, section=section)
File "/userdirectory/rss2email-3.5/rss2email/email.py", line 339, in send
config=config, section=section)
File "/userdirectory/rss2email-3.5/rss2email/email.py", line 167, in smtp_send
smtp.send_message(message, sender, [recipient])
File "/usr/local/lib/python3.2/smtplib.py", line 821, in send_message
g.flatten(msg_copy, linesep='\r\n')
File "/usr/local/lib/python3.2/email/generator.py", line 91, in flatten
self._write(msg)
File "/usr/local/lib/python3.2/email/generator.py", line 150, in _write
self._dispatch(msg)
File "/usr/local/lib/python3.2/email/generator.py", line 176, in _dispatch
meth(msg)
File "/usr/local/lib/python3.2/email/generator.py", line 412, in _handle_text
super(BytesGenerator,self)._handle_text(msg)
File "/usr/local/lib/python3.2/email/generator.py", line 214, in _handle_text
self._write_lines(payload)
File "/usr/local/lib/python3.2/email/generator.py", line 128, in _write_lines
self.write(line.rstrip('\r\n'))
File "/usr/local/lib/python3.2/email/generator.py", line 371, in write
self._fp.write(s.encode('ascii', 'surrogateescape'))

UnicodeEncodeError: 'ascii' codec can't encode character '\xfc' in position 133: ordinal not in range(128)

follow symlinks of datafile and configfile

Use case, configfile contains sensible data, and is in a specific directory, and $XDG_CONFIG_HOME is a symlink. When configfile is saved (rewritten + renamed), we want don't want to overwrite the symlink itself but the original file.

The same applies for datafile.
The attached patch (against Debian Jessie's r2e 3.9) addresses both issues:

--- feeds.py.orig   2015-02-20 14:18:04.804324947 -0300
+++ feeds.py    2015-02-20 14:33:59.101057048 -0300
@@ -135,7 +135,8 @@
         self.configfiles = configfiles
         if datafile is None:
             datafile = self._get_datafile()
-        self.datafile = datafile
+        # for unix, follow symlinks to create tmp dat file in the user-expected directory
+        self.datafile = _os.path.realpath(datafile)
         if config is None:
             config = _config.CONFIG
         self.config = config
@@ -338,18 +339,19 @@
                 version, self.datafile_version))

     def save(self):
-        _LOG.debug('save feed configuration to {}'.format(self.configfiles[-1]))
+        dst_config_file = _os.path.realpath(self.configfiles[-1])
+        _LOG.debug('save feed configuration to {}'.format(dst_config_file))
         for feed in self:
             feed.save_to_config()
-        dirname = _os.path.dirname(self.configfiles[-1])
+        dirname = _os.path.dirname(dst_config_file)
         if dirname and not _os.path.isdir(dirname):
             _os.makedirs(dirname, mode=0o700, exist_ok=True)
-        tmpfile = self.configfiles[-1] + '.tmp'
+        tmpfile = dst_config_file + '.tmp'
         with open(tmpfile, 'w') as f:
             self.config.write(f)
             f.flush()
             _os.fsync(f.fileno())
-        _os.rename(tmpfile, self.configfiles[-1])
+        _os.rename(tmpfile, dst_config_file)
         self._save_feeds()

     def _save_feeds(self):

order of items in RSS

I have a RSS feed for which each run triggers sending a notification. I suspect that the order of the elements changes in the RSS.

Does the order of items matter for rss2email?

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.