Reply via email (mailto link) in RSS feed at the end of each post

I came across this post https://ethanmarcotte.com/wrote/replyin/ where author says he added Reply via email link at the end of each post in RSS feed so people have this option to respond via email

In his feed (XML format) it looks like this

pa href=mailto:[email protected]?subject=Reply%20to:%20“Bookiversary.”Reply via email/a/p

I am using Underscores and it has several default feed templates that come with WP install. I checked WP Codex https://codex.wordpress.org/Customizing_Feeds and didn't find anything specific on how to modify templates to add this feature.

Question: is this done by modifying RSS templates? If so, which one and how?

Update: Based on @birgire suggestion to use the_content_feed filter, the following code adds email address at the end of my RSS feed (as per XML view)

    // add custom content to all feeds

function add_content_to_all_feeds($content) {

      $after = 'pa href=mailto:[email protected] via email/a/p';

    if (is_feed()) {

        return $content . $after;

    } else {

        return $content;

    }

}
add_filter('the_content_feed', 'add_content_to_all_feeds');

Topic feed rss Wordpress

Category Web


This should most likely be enough:

function add_content_to_all_feeds( $content ) {
      $after = '...';
      return $content . $after;
}
add_filter( 'the_content_feed', 'add_content_to_all_feeds' );

without the is_feed() check.

I am wondering what are those question mark and percent signs in ?subject=Reply%20to:%20“Bookiversary.” ?

This is so called URL encoding where %20 means space.

Also can adding 'reply by email' option to feeds cause lots of email spam?

It might, but some bots don't even need to scan your site for emails, to spam you.

They can just guess the most likely emails from your domain name, e.g.

[email protected], 
[email protected], 
...

and try to spam directly.

Probably also guess it from the public usernames.

You could also link to your spam protected contact form instead.

Consider using an email account, with a good spam protection, regardless.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.