Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
function emailuser()
{

  if (mw.config.get('wgNamespaceNumber') == 2 | mw.config.get('wgNamespaceNumber') == 3)
  {
    var start = document.title.indexOf(":") + 1;
    var end = document.title.indexOf("/");
    if (end != -1)
    {
        var user = document.title.slice(start,end);
    }
    else
    {
        var user = document.title.slice(start).replace(" - Wikipedia, the free encyclopedia","");
    }
    var img = mw.html.element("img",{src:'//upload.wikimedia.org/wikipedia/commons/thumb/a/a0/Email_go.png/15px-Email_go.png'});
    addPortletLink ("p-views", "//en.wikipedia.org/wiki/Special:EmailUser/"+user, "", "email-user", "Email this user");
    document.getElementById("email-user").firstChild.firstChild.innerHTML = img;
  }
}

$(function (){
  emailuser ();
 
});