Forums

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

  1. Nicolas Viallet
    Member
    Posted 2 months 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 2 months ago #

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

  3. Antonio Max
    Member
    Posted 2 months ago #

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

  4. Nicolas Viallet
    Member
    Posted 2 months ago #

    Hi Jeremy,

    I'm looking forward the next update then!

  5. mainstay
    Member
    Posted 2 months 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 2 months 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 2 months ago #

    hey - that's pretty cool - thanks!

    worked nicely =)

  8. Antonio Max
    Member
    Posted 2 months 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' );

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.