- Issue created by @na.karimi
- Status changed to Closed: duplicate
11 months ago 7:39pm 4 February 2024
I was on Drupal 9, and used Swiftmailer to send email.
Upgraded to Drupal 10, but Swiftmailer deprecated, so need to change to another alternative, so Installed the symfony_mailer.
The symfony_mailer configuration completed and can send email, or invite users with email.
But when selecting the subscriptions from the list and try to send newsletter to them, it failed with the following error,
`SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'from_mail' cannot be null: INSERT INTO "views_send_spool"`
Looks the from_mail missed, while in the preview the email data that being send it is completely available.
In my investigate I found _views_send_prepare_mail method that overrides the data and the message data missing.
```
function views_send_batch_deliver($message, $plain_format, $attachments, &$context) {
_views_send_prepare_mail($message, $plain_format, $attachments);
$status = views_send_deliver($message);```
Inside that function we have
```$mail = \Drupal::service('plugin.manager.mail')->mail('views_send', $key, $params['to_formatted'], \Drupal::languageManager()->getDefaultLanguage()->getId(), $params, $params['from_formatted'], FALSE);
```
That returns the data, but it is not containing the from_mail value and to_mail value, and just "to" that has subject.
Array
(
[id] => views_send_direct
[module] => views_send
[key] => direct
[to] => Certification of title
[langcode] => en
[params] => Array
(
[from_name] => title Standard
[from_mail] => nasser.test@test.com
[from_formatted] => title Standard
[to_name] => Certification of title
[to_mail] => test@gmail.com
[to_formatted] => Certification of title
[subject] => Test News latter 4
[body] => Drupal\Core\Render\Markup Object
(
[string:protected] =>
Qui consectetur fugi
)
[headers] => Array
(
[Precedence] => bulk
)
[attachments] => Array
(
)
[plain] => 1
)
[reply-to] => title Standard
[send] =>
[result] =>
[subject] =>
)
Closed: duplicate
2.0
Code