It is not possible out of the box. I'm not sure about 10.1, but in 9.1 you needed to:
- update regex for
Reply to
input value in Sitecore config:
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore>
<fromReplyToEmailRegexValidator>
<param desc="regexValue">^(\$[a-zA-Z0-9\-_]+\$)?([a-zA-Z0-9\+\-_\!\$\%\&\*\?]+(?:\.[a-zA-Z0-9\+\-_\'\!\$\%\&\*\?]+)*@(([a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9]+)+)|(\[\d{1,3}(\.\d{1,3}){3}\])))?$</param>
</fromReplyToEmailRegexValidator>
</sitecore>
</configuration>
- add your processor to
SendEmail
pipeline before Sitecore.EmailCampaign.Cm.Pipelines.SendEmail.SendEmail, Sitecore.EmailCampaign.Cm
processor and replace token value, e.g. like that:
public class ReplaceTokenInReplyTo
{
public void Process(SendMessageArgs args)
{
if (args.CustomData["EmailMessage"] is EmailMessage message && message.ReplyTo != null)
{
var reply = message.ReplyTo;
var indexOf = reply.IndexOf('$');
var lastIndexOf = reply.LastIndexOf('$');
if (indexOf != lastIndexOf)
{
var token = reply.Substring(indexOf, lastIndexOf - indexOf + 1);
var replyTo = args.EcmMessage.ReplaceTokens(token);
if (!string.IsNullOrEmpty(replyTo)
&& replyTo != token
&& new EmailAddressAttribute().IsValid(replyTo))
{
message.ReplyTo = replyTo;
}
else
{
message.ReplyTo = message.ReplyTo.Replace(token, string.Empty);
}
}
}
}
}