WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
Sharing : Share by email [improvement] (12 posts)

  1. Nicolas
    Member
    Posted 1 year ago #

    Hi,

    I've tried the sharing by email option and I would like to know if it's possible to change the content of the email sent.

    IMHO, this email looks too much like those spammy email you receive saying. "Amazing site: spam link"

    How could I change the following:
    "XXX thinks you may be interested in the following post: title + link"

    and add the excerpt or meta description to give more details about the post. That's an email not a tweet ;)

    I found this so far:

    function sharing_email_send_post( $data ) {
    	$content  = sprintf( __( '%1$s (%2$s) thinks you may be interested in the following article:'."\n\n", 'jetpack' ), $data['name'], $data['source'] );
    	$content .= $data['post']->post_title."\n";
    	$content .= get_permalink( $data['post']->ID )."\n";
    
    	wp_mail( $data['target'], '['.__( 'Shared Post', 'jetpack' ).'] '.$data['post']->post_title, $content );
    }

    How do I add the excerpt for example?

    Thanks for your help.

    http://wordpress.org/extend/plugins/jetpack/

  2. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    I like the idea! We'll consider making some improvements to that email in a future Jetpack update.

  3. Antonio Max
    Member
    Posted 1 year ago #

    Yea, I second that.
    We should be able to customize that message (for other languages maybe?) and the mail subject title.

  4. Nicolas
    Member
    Posted 1 year ago #

    Hi Jeremy,

    I'm looking forward the next update then!

  5. mainstay
    Member
    Posted 1 year ago #

    completely agree - and looking forward to the next update!

    I also would like to either

    a) change the from (currently wordPress@domain.com) email address to something I set, or

    b) have the person sending the link provide their own email address.

    All of the people I've shared links from my own site say the received email ends up in Junk Mail.

  6. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 1 year ago #

    a) change the from (currently wordPress@domain.com) email address to something I set

    The sender address is actually the default sender address set by WordPress. You can customize it with a small function, like so:

    function jeherve_from_email( $email ) {
    	return 'youraddress@domain.com';
    }
    add_filter( 'wp_mail_from', 'jeherve_from_email' );
  7. mainstay
    Member
    Posted 1 year ago #

    hey - that's pretty cool - thanks!

    worked nicely =)

  8. Antonio Max
    Member
    Posted 1 year ago #

    I'm using this one to change the mail name as well:

    function my_mail_from( $email )
    {
        return 'something@domain.com';
    }
    add_filter( 'wp_mail_from', 'my_mail_from' );
    
    function my_mail_from_name( $name )
    {
        return 'Le website name';
    }
    add_filter( 'wp_mail_from_name', 'my_mail_from_name' );
  9. np79
    Member
    Posted 11 months ago #

    Hi

    I need to do change the wordpress@domain.com, I see the solution above but not sure how to implement it/ what to do with the function.

    Any advice / suggestions are greatly appreciated!!

    Thanks

  10. Ashaan
    Member
    Posted 11 months ago #

    Hi
    In the sharing by email option,

    does anyone have a solution to add an excerpt also to the email content being shared. In addition to the title and the link that is already there in the email content?

    Thanks

  11. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 10 months ago #

    @np79 See my post above; you'll want to add that code into a functionality plugin , or into your theme's functions.php file.

    @Ashaan That's not possible at the moment, unless you were to edit the sharing_email_send_post function in modules/sharedaddy/sharedaddy.php in the Jetpack plugin. I would recommend against it though, since your changes will be overwritten in the next plugin update.

    As I mentioned earlier, I took note of Nicolas's suggestion and we'll consider improving the email in a future Jetpack update.

    Thanks!

  12. Ashaan
    Member
    Posted 10 months ago #

    Thanks Jeremy. Will look forward to that update then. Very happy to have a plugin like jetpack. Appreciate your effort!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.