In a custom plugin, I would like to use Craft's ability to register email message keys in order to keep emails consistent, and I would like to be able to send these emails to users as well as non-users. My understanding is that I would need to use the sendEmailByKey method of the EmailService to send emails using registered keys, which is defined like this:
public function sendEmailByKey(UserModel $user, $key, $variables = array())
This method only accepts a UserModel for the recipient, so it doesn't look like there's a way to send an email by key to an arbitrary email address. Is there a different way to send these registered emails to non-users?
new UserModel()
and assign your non-user email to it before callingsendEmailByKey
? – Brad Bell Oct 1 '15 at 22:23