Add Subject in Email on Sharethis?

1.4k Views Asked by At

I have to add subject in my email when I used sharethis plugin. Can anyone help me how can I add Subject in email ?

Here are my Meta tags.

<meta name="og:title" content="Click here to shop and fund {{$campaign_details->campaign_title}}" />
<meta name="og:url" content="{{url()->current()}}" />
<meta name="og:image" content="imgurl" />
<meta name="og:description" content="desc" />
<meta name="og:site_name" content="xyz.com" />

And below are my button code.

<div class="sharethis-inline-share-buttons"
  data-url="{{url()->current()}}"
  data-title="Click here"
  data-image="img.png"
  data-username="Naushil"
  data-description = "demo"
  data-message=" Goal is : 125">
</div>
3

There are 3 best solutions below

1
G. Smith On

I couldn't find documentation on it, but I had the same problem and just crawled the JS file it calls for clues. The field you're looking for is data-email-subject="whatever" . This will curate "whatever" into the subject line of your shared email.

0
Pascal Ramanathan On

you have to override the default events and write your own ones instead. That way you can change the subject as you like. This is what I did:

function overrideShareSendMail() {
$('div[data-network="email"]').replaceWith($('div[data-network="email"]').clone());
$('div[data-network="email"]').on("click", function () {
    var emailSubject = "Pyramide";
    var emailBody = window.location.href;
    window.location.href = "mailto:?subject=" + emailSubject + "&body=" + emailBody;
});
}
0
Volodymyr On

this worked for me

    <script>
        window.onload = function() {
            let stickyButtonsConfig = window.__sharethis__.config['sticky-share-buttons'];
            stickyButtonsConfig.subject = 'Subject';
            window.__sharethis__.load('sticky-share-buttons', stickyButtonsConfig);
        };
    </script>

details - https://sharethis.com/support/guides/reinitialize-sharethis-buttons-specific-sharing-parameters/

The only thing is that probably you'll need to hide the widget until load will be triggered, because until that moment the subject will remain the same.