"Keep smiling, because life is a beautiful thing and there's so much to smile about." -Marilyn Monroe

Tuesday, May 10, 2022

Email Notifications

Now that I have returned to FlatPress as my blog software of choice, I have been trying to figure out how to send email notifications when a new blog is posted. There are plenty of examples online on how to do this but in 95% of the instances, the code works with a database driven blog system. FlatPress is a flat file based system meaning that it is somewhat more difficult to pull the blog titles from the text files housing the blog post itself.

I found a script that seems to do just that however…it updates the blog titles and then sends out the email notification using a “newsletter” document to notify all of the subscribers that a new blog has been posted. One small detail is left out however…the email notification has to be triggered by the administrator, it is not automatic as I would like it to be. It works by reading the rss feed that is part of the blog system site and checks to see if the titles match the titles that were there the last time a notification was sent out. If there are no changes, no email is sent. I am in the process of “tweaking” what the email looks like and just as you might expect, different email servers display the email differently. As an example, Outlook (hotmail) does not show the blog title link as clickable and one of the other email servers does not display the image that is part of the newsletter. Practice makes perfect however, and who knows…I may be able to figure out how to have the notification sent out automatically. I can dream, can’t I?

Blogmaster