Go to file
Simon Vieille 7c1c2a7233
update importation command: add option --file
2020-11-13 09:14:31 +01:00
bin Add initial set of files 2020-11-11 13:17:58 +01:00
config add url to the feed in mailing:list 2020-11-11 17:44:53 +01:00
private add documentation 2020-11-12 16:17:33 +01:00
public update logo 2020-11-11 22:36:36 +01:00
src update importation command: add option --file 2020-11-13 09:14:31 +01:00
templates update home page 2020-11-11 23:05:08 +01:00
.env add documentation 2020-11-12 16:17:33 +01:00
.gitignore security: add download action for attachments - refactor controllers (params) 2020-11-11 19:48:16 +01:00
.php-version add importation mails and views 2020-11-11 16:37:07 +01:00
README.md update importation command: add option --file 2020-11-13 09:14:31 +01:00
composer.json add importation mails and views 2020-11-11 16:37:07 +01:00
symfony.lock add importation mails and views 2020-11-11 16:37:07 +01:00

README.md

Mail RSS

This application allows you to transform emails into an RSS feed without connecting to a mailbox.

Installation

Requirements:

$ git clone https://gitnet.fr/deblan/mail-rss.git
$ cd mail-rss
$ cp .env env.local
$ composer install

Populate .env.local:

  • APP_ENV: prod or dev
  • DATABASE_URL: read the documentation
  • APP_DEFAULT_URI: URI of the application (without trailing slash)

Be sure that the webserver can read/write private/, var/ and migrations/.

$ php bin/console -e dev doctrine:migrations:diff
$ php bin/console -e dev doctrine:migrations:exe --up DoctrineMigrations\\VersionXXXXXXXXXXXXX

And read the doc to publish a symfony app: https://symfony.com/doc/5.3/deployment.html

Usage

Use case: you want to create a feed of a newsletter named "Foo Bar".

$ sudo mkdir /var/lib/mailrss
$ sudo chmod 0770 /var/lib/mailrss
$ sudo chown you-web-user:nogroup

Add an alias into your mailserver:

# /etc/aliases
mailrss-foobar: "| > /var/lib/mailrss/foobar-$(date +%s) && chmod o+rw /var/lib/mailrss/foobar-$(date +%s)"

Then run $ sudo newaliases.

Add a mailing in the app:

$ php bin/console mailing:new "Fo Bar"

# Oops, you made a mistake in the label, let's fix it

$ php bin/console mailing:list
$ php bin/console mailing:rename xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx "Foo bar"

With mailing:list, you retrieve the URL of the feed.

In case of you want to delete the mailing:

$ php bin/console mailing:delete xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

Finally, create a script run in a cron:

#!/bin/sh

cd "/path/to/app"

find /var/lib/mailrss -name "foobar-*" | while read MAIL_FILE; do
	MAILING_ID="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

	php bin/console mail:import "$MAILING_ID" -f "$MAIL_FILE" && rm "$MAIL_FILE"
done

You also can import a mail using stdin:

$ php bin/console mail:import "$MAILING_ID" < "$MAIL_FILE"
$ command | php bin/console mail:import "$MAILING_ID"

If you wan create another feed then:

  • Create an aliase
  • Create a mailing
  • Update your script run in the cron
  • Get the URI using mailing:list