New functionalities: Templating, Languages, Logging, Previewing, Cors #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thank you @e-dschungel very much for this very handy script. I much appreciate using this script in several web projects. But I am missing some functionalities which I implemented and would like to share with you...
With this pull request, I would like to add some functionalities to the rssgoemail project. The following functionalities are added:
Templating
In the config file there is a new configuration called
templateType
. When switching this configuration fromstring
string totmpl
tmpl a templating mechanism is activated. This means that the email body will now be created by applying a given tempate file instead of just performing a search and replace on some placeholders. Two default template files are given in the folder/tmpl/
with the namesemail.php
anditem.php
. Whereitem.php
is the template file for one feed item andemail.php
is the template file for the assembled list of feed items to be sent.Inside the template files, dynamic content can be added using the following possibilities:
<?php echo $rge_config['<param>']; ?>
: inserting any parameter value from the configuration<?php echo $content['##FEED_COPYRIGHT##']; ?>
: inserting dynamic content from the rss feed (see available Placeholders)<?php echo text('unsubscribe_lbl'); ?>
: inserting translatable static content (see Languages functionality)Languages
The
text()
function allows to translate content available in the/tmpl/language.php
file. This file consists of an array with all available languages as entries. Inside each language entry there are language constants and their corresponding translations.Now, by applying the function
text('readMore')
, the translation of the readMore will be returned based on the language chosen in the configuration:$rge_config['language']
.Logging
There is a new file
/log/mail.log
where logging happens. Everytime the rssgoemail script is executed one logging entry will be created telling you if the email was sent successfully or the raised error message if not.Previewing
Before sending a feed email to a lot of subscribers its useful to send the email to your own email address to check if the email gets generated correctly. You can enter the preview mode of the reegoemail script by passing the two request variables
preview=true
andemail=<YOUR-ADDRESS>
to the script. When in preview mode no guids are added to the data base. Therefore the feed items will be sent afterwards normally to your subscribers.Cors
When cors is activated in the configuration (
allowCors
) the script can be executed by 3rd party application that is running on a different server. This way another webapp or website containing a send button can kick off the sending process.Feel free to comment on this PR is you have any questions or found a bug. Would love to see these features making it into an official release from you one day...