- πΊπΈUnited States bluegeek9
The message project does not send emails. You might want to look at Message Subscribe β or Message Notify β
I would like to send emails, using message template, to our Simplenews newsletter subscribers. Some may or may not have accounts. I only have their email addresses. So, I wish to pass the email address to the message create command.
Currently to send notification of new node posted to account members, I use this:
$message = Message::create([
'template' => $message_template,
'uid' => $uid,
]);
if ($message->hasField('field_node_reference')) {
$message->set('field_node_reference', $node);
}
$message->save();
$notifier = \Drupal::service('message_notify.sender');
$notifier->send($message);
I am wondering if I can add something like the following in order to send so a specific email address:
$message = Message::create([
'template' => $message_template,
'uid' => $uid,
'mail' => 'sendto@email.com',
]);
or
$message->set('mail', 'sendto@email.com';
Is there a way to do this, and if so, how?
Closed: works as designed
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
The message project does not send emails. You might want to look at Message Subscribe β or Message Notify β