Domain tokens are not replaced when trying to send email activity for a contact. This seems like a bug in civicrm or wrong documentation. This can be fixed by applying below patch.
diff --git a/CRM/Activity/BAO/Activity.php b/CRM/Activity/BAO/Activity.php
index 787a1c955d..35133010e1 100644
--- a/CRM/Activity/BAO/Activity.php
+++ b/CRM/Activity/BAO/Activity.php
@@ -1587,6 +1587,12 @@ LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND
$values = array_merge($values, $details["{$contactId}"]);
}
+ $domainTokens = array_merge($subjectToken, $messageToken);
+ $domain = CRM_Core_BAO_Domain::getDomain();
+ foreach (['subject', 'text', 'html'] as $bodyType) {
+ $$bodyType = CRM_Utils_Token::replaceDomainTokens($$bodyType, $domain, TRUE, $domainTokens, TRUE);
+ }
+
$tokenSubject = CRM_Utils_Token::replaceContactTokens($subject, $values, FALSE, $subjectToken, FALSE, $escapeSmarty);
$tokenSubject = CRM_Utils_Token::replaceHookTokens($tokenSubject, $values, $categories, FALSE, $escapeSmarty);