Can't send email out by using token [node:author:mail]

Created on 22 November 2023, about 1 year ago
Updated 23 November 2023, about 1 year ago

can't send email out through #rules in Drupal10, I am using the token [node:author:mail] for the send to email action when user's node published, the system give me "Error message Unable to send email..." if I change the send to email action to a fixed address like abc@gmail.com then no problem for sending email out, the token [node:author:mail] is correct, so I don't know what am I missing, please advise if you know this ,Thank you.

There are debug messages like this in the log :

Deprecated function: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in Drupal\typed_data\PlaceholderResolver->replacePlaceHolders() (line 172 of /home/abc/public_html/web/modules/typed_data/src/PlaceholderResolver.php)
#0 /home/abc/public_html/web/core/includes/bootstrap.inc(164): _drupal_error_handler_real(8192, 'str_replace(): ...', '/home/abc...', 172)
#1 [internal function]: _drupal_error_handler(8192, 'str_replace(): ...', '/home/abc...', 172)
#2 /home/abc/public_html/web/modules/typed_data/src/PlaceholderResolver.php(172): str_replace(Array, Array, NULL)
#3 /home/abc/public_html/web/modules/rules/src/Plugin/RulesDataProcessor/TokenProcessor.php(72): Drupal\typed_data\PlaceholderResolver->replacePlaceHolders(NULL, Array)
#4 /home/abc/public_html/web/modules/rules/src/Context/ContextHandlerTrait.php(320): Drupal\rules\Plugin\RulesDataProcessor\TokenProcessor->process(NULL, Object(Drupal\rules\Context\ExecutionState))
#5 /home/abc/public_html/web/modules/rules/src/Context/ContextHandlerTrait.php(297): Drupal\rules\Plugin\RulesExpression\ActionExpression->processValue(NULL, Array, Object(Drupal\rules\Context\ExecutionState))
#6 /home/abc/public_html/web/modules/rules/src/Context/ContextHandlerTrait.php(83): Drupal\rules\Plugin\RulesExpression\ActionExpression->processData(Object(Drupal\rules\Plugin\RulesAction\SystemSendEmail), Object(Drupal\rules\Context\ExecutionState))
#7 /home/abc/public_html/web/modules/rules/src/Plugin/RulesExpression/ActionExpression.php(109): Drupal\rules\Plugin\RulesExpression\ActionExpression->prepareContext(Object(Drupal\rules\Plugin\RulesAction\SystemSendEmail), Object(Drupal\rules\Context\ExecutionState))
#8 /home/abc/public_html/web/modules/rules/src/Plugin/RulesExpression/ActionSetExpression.php(33): Drupal\rules\Plugin\RulesExpression\ActionExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
#9 /home/abc/public_html/web/modules/rules/src/Plugin/RulesExpression/RuleExpression.php(121): Drupal\rules\Plugin\RulesExpression\ActionSetExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
#10 /home/abc/public_html/web/modules/rules/src/Plugin/RulesExpression/ActionSetExpression.php(33): Drupal\rules\Plugin\RulesExpression\RuleExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
#11 /home/abc/public_html/web/modules/rules/src/EventSubscriber/GenericEventSubscriber.php(161): Drupal\rules\Plugin\RulesExpression\ActionSetExpression->executeWithState(Object(Drupal\rules\Context\ExecutionState))
#12 [internal function]: Drupal\rules\EventSubscriber\GenericEventSubscriber->onRulesEvent(Object(Drupal\rules\Event\EntityEvent), 'rules_entity_up...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#13 /home/abc/public_html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Drupal\rules\Event\EntityEvent), 'rules_entity_up...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#14 /home/abc/public_html/web/modules/rules/rules.module(183): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Drupal\rules\Event\EntityEvent), 'rules_entity_up...')
#15 [internal function]: rules_entity_update(Object(Drupal\node\Entity\Node))
#16 /home/abc/public_html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(409): call_user_func_array(Object(Closure), Array)
#17 /home/abc/public_html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}(Object(Closure), 'rules')
#18 /home/abc/public_html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): Drupal\Core\Extension\ModuleHandler->invokeAllWith('entity_update', Object(Closure))
#19 /home/abc/public_html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(217): Drupal\Core\Extension\ModuleHandler->invokeAll('entity_update', Array)
#20 /home/abc/public_html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(900): Drupal\Core\Entity\EntityStorageBase->invokeHook('update', Object(Drupal\node\Entity\Node))
#21 /home/abc/public_html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(564): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object(Drupal\node\Entity\Node))
#22 /home/abc/public_html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(781): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\node\Entity\Node), true)
#23 /home/abc/public_html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(489): Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object(Drupal\node\Entity\Node), true)
#24 /home/abc/public_html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(806): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\node\Entity\Node))
#25 /home/abc/public_html/web/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\node\Entity\Node))
#26 /home/abc/public_html/web/core/lib/Drupal/Core/Action/Plugin/Action/PublishAction.php(22): Drupal\Core\Entity\EntityBase->save()
#27 /home/abc/public_html/web/core/lib/Drupal/Core/Action/ActionBase.php(22): Drupal\Core\Action\Plugin\Action\PublishAction->execute(Object(Drupal\node\Entity\Node))
#28 /home/abc/public_html/web/core/modules/system/src/Entity/Action.php(129): Drupal\Core\Action\ActionBase->executeMultiple(Array)
#29 /home/abc/public_html/web/core/modules/views/src/Plugin/views/field/BulkForm.php(424): Drupal\system\Entity\Action->execute(Array)
#30 /home/abc/public_html/web/core/modules/views/src/Form/ViewsFormMainForm.php(183): Drupal\views\Plugin\views\field\BulkForm->viewsFormSubmit(Array, Object(Drupal\Core\Form\FormState))
#31 /home/abc/public_html/web/core/modules/views/src/Form/ViewsForm.php(190): Drupal\views\Form\ViewsFormMainForm->submitForm(Array, Object(Drupal\Core\Form\FormState))
#32 [internal function]: Drupal\views\Form\ViewsForm->submitForm(Array, Object(Drupal\Core\Form\FormState))
#33 /home/abc/public_html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(114): call_user_func_array(Array, Array)
#34 /home/abc/public_html/web/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState))
#35 /home/abc/public_html/web/core/lib/Drupal/Core/Form/FormBuilder.php(597): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState))
#36 /home/abc/public_html/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('views_form_cont...', Array, Object(Drupal\Core\Form\FormState))
#37 /home/abc/public_html/web/core/lib/Drupal/Core/Form/FormBuilder.php(224): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\views\Form\ViewsForm), Object(Drupal\Core\Form\FormState))
#38 /home/abc/public_html/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2269): Drupal\Core\Form\FormBuilder->getForm(Object(Drupal\views\Form\ViewsForm), Object(Drupal\views\ViewExecutable), Array)
#39 [internal function]: Drupal\views\Plugin\views\display\DisplayPluginBase->elementPreRender(Array)
#40 /home/abc/public_html/web/core/lib/Drupal/Core/Security/DoTrustedCallbackTrait.php(111): call_user_func_array(Array, Array)
#41 /home/abc/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(797): Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_ren...', 'exception', 'Drupal\\Core\\Ren...')
#42 /home/abc/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(386): Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array)
#43 /home/abc/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(458): Drupal\Core\Render\Renderer->doRender(Array)
#44 /home/abc/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(204): Drupal\Core\Render\Renderer->doRender(Array, false)
#45 /home/abc/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(238): Drupal\Core\Render\Renderer->render(Array, false)
#46 /home/abc/public_html/web/core/lib/Drupal/Core/Render/Renderer.php(592): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#47 /home/abc/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(239): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#48 /home/abc/public_html/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(128): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#49 /home/abc/public_html/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#50 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#51 /home/abc/public_html/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#52 /home/abc/public_html/vendor/symfony/http-kernel/HttpKernel.php(186): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object(Symfony\Component\HttpKernel\Event\ViewEvent), 'kernel.view')
#53 /home/abc/public_html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#54 /home/abc/public_html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#55 /home/abc/public_html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#56 /home/abc/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#57 /home/abc/public_html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#58 /home/abc/public_html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#59 /home/abc/public_html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#60 /home/abc/public_html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#61 /home/abc/public_html/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#62 /home/abc/public_html/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#63 {main}

And another error mail message in the log :

Error sending email (from abc to [node:author:mail] with reply-to 111@gmail.com).

Here is my exported rules :

uuid: 2c68b1c2-0ea4-4979-9553-13b91b0ca958
langcode: en-gb
status: true
dependencies: { }
id: send_email_to_author_after_node_published
label: 'Send email to author after node published'
events:
-
event_name: 'rules_entity_update:node--text_case_study'
description: ''
tags: { }
config_version: '3'
expression:
id: rules_rule
uuid: 8e837fe5-1463-4984-89e0-57c09acc15b9
weight: 0
conditions:
id: rules_and
uuid: ea109dd0-25b8-4a76-a15b-7938f1663c00
weight: 0
conditions:
-
id: rules_condition
uuid: 883b40d4-7137-4136-bc09-dac95a7e5a33
weight: 0
condition_id: rules_node_is_published
negate: false
context_values: { }
context_mapping:
node: node
context_processors: { }
provides_mapping: { }
actions:
id: rules_action_set
uuid: a57af3f5-d25c-45f0-ae49-481681c295d8
weight: 0
actions:
-
id: rules_action
uuid: 1036df33-5fef-4fca-889b-20ba7c9c2b37
weight: 0
action_id: rules_send_email
context_values:
to:
- '[node:author:mail]'
subject: 'Your case study has been published'
message: 'Your submission "[node:title] " has been reviewed and approved.It will be published at {{ node | entity_url }}'
reply: 111@gmail.com
language: ''
context_mapping: { }
context_processors:
to:
rules_tokens: { }
subject:
rules_tokens: { }
message:
rules_tokens: { }
reply:
rules_tokens: { }
language:
rules_tokens: { }
provides_mapping: { }

πŸ’¬ Support request
Status

Fixed

Component

Rules Core

Created by

πŸ‡¬πŸ‡§United Kingdom freelylw

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024