Personal contact form button if available
This was the solution I came up with:

/**
 * Implements hook_preprocess_user().
 */
function MYTHEME_preprocess_user(&amp;$variables)
{
    $account = $variables['elements']['#user'];
    if ($account-&gt;getEmail() != '') {
        $contactUrl = Url::fromRoute('entity.user.contact_form', ['user' =&gt; $account-&gt;id()]);
        if ($contactUrl-&gt;access()) {
            $contactLink = Link::fromTextAndUrl('Contact', $contactUrl);
            $variables['contact_btn'] = $contactLink-&gt;toRenderable();
            $variables['contact_btn']['#attributes'] = array('class' =&gt; array('btn', 'btn-primary', 'btn-contact-user'));
        }
    }
}