$params['recipient'
] =
$recipient;
} else { throw new MailHandlerException('Unable to determine message recipient'
);
} // Send email to the recipient(s).
$key_prefix =
$message->
isPersonal() ? 'user' : 'page';
$this->mailManager->
mail('contact',
$key_prefix . '_mail',
$to,
$recipient_langcode,
$params,
$sender_cloned->
getEmail());
// If requested, send a copy to the user, using the current language.
if ($message->
copySender()) { $this->mailManager->
mail('contact',
$key_prefix . '_copy',
$sender_cloned->
getEmail(),
$current_langcode,
$params,
$sender_cloned->
getEmail());
} // If configured, send an auto-reply, using the current language.
if (!
$message->
isPersonal() &&
$contact_form->
getReply()) { // User contact forms do not support an auto-reply message, so this
// message always originates from the site.
if (!
$sender_cloned->
getEmail()) { $this->logger->
error('Error sending auto-reply, missing sender e-mail address in %contact_form',
[ '%contact_form' =>
$contact_form->
label(),
]);
}