How to attach an image using AddThis widget while sharing a web page via email?

| | 1 min read

Lets consider a situation in which you are using addthis widget for sharing a page in your site via email and you want to attach an image with the mails that is been send from your site. In the article you can find out how to add a common image to the all mails send from a site and also how to attach images depending on different users.

Inorder to add an image with the mails when a page is shared via email, first goto www.addthis.com and login using your gmail-id.

Goto the settings page 'https://www.addthis.com/settings/user' and click on the profiles option in the left sidebar.

Create a profile you will be provided with a profile-id.

Create a new template by clicking on the 'Add a template' button in the page.

You can add a template name and then click on the 'html content' tab.

Add the following template


test-image
{{note}}
{{url}}

Save the added template.

Now goto the page template in your theme and the following script.


<script type="text/javascript">
  var addthis_share = addthis_share||{};
  var addthis_pub="ra-52a1b5cc7720659a";//the profile id.
  addthis_share.email_template = 'template1';// template name.
</script>

Now when you share a page via email then it will contain the image which you have added in the template.

You can also add different images for different users by creating new profiles for the users and providing the profile id in the template with respect to the users.