TypeError: UnstructuredHeader.

Created on 9 October 2023, 9 months ago
Updated 4 November 2023, 8 months ago

Problem/Motivation

drupal 10.1.5
php 8.1.23

When I send an email I get a continuous display of "Initializing..."

There is also a log error message: TypeError: Symfony\Component\Mime\Header\UnstructuredHeader::__construct(): Argument #2 ($value) must be of type string, null given, called in /var/www/d10/web/core/lib/Drupal/Core/Mail/Plugin/Mail/PhpMail.php on line 106 in Symfony\Component\Mime\Header\UnstructuredHeader->__construct() (line 23 of /var/www/d10/vendor/symfony/mime/Header/UnstructuredHeader.php).

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Closed: works as designed

Version

2.0

Component

Miscellaneous

Created by

🇺🇸United States gscerb

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

Comments & Activities

  • Issue created by @gscerb
  • 🇺🇦Ukraine paulrad

    Hi, @gscerb! Could you please clarify how you get this error? Couldn't reproduce it locally.

  • 🇳🇴Norway hansfn

    Thx for trying to reproduce, paulrad. I have minimal time for this module, as is obvious, so I'm happy when you help each other.

    Could it be related to 🐛 View Token Substitution does not work Active ? The error "Argument #2 ($value) must be of type string, null given" indicates that some value is missing.

  • 🇳🇴Norway hansfn

    You are trying to send a (HTML) formatted e-mails, gscerb? If so, this is a duplicate of 🐛 Impossible to send formated emails Active . If you agree, please close this issue as duplicate and follow that other issue.

  • 🇮🇳India viren18febS

    @gscerb
    It's working for me with Default PHP mailer in mail system. please update the steps for reproduce.

  • 🇳🇴Norway hansfn

    @viren18febS: I just commented that this is likely a duplicate for formatted e-mails ;-) But thanks for chiming in. You could of course try to reproduce the issue yourself with formatted e-mails.

  • 🇺🇸United States gscerb

    In the Views Send "text format" dropdown I don't have the option for plain text. I only have:
    Full Html
    Basic Html
    Restricted Html
    Email Html

    I had the same "Initializing..." problem using:
    Mail System... Default PHP Mailer
    or, Drupal Symfony Mailer

  • 🇺🇸United States gscerb

    In Configuration... Content Authoring... Text Formats and Editors
    I edited "Email HTML" to have no text editor and "Display any HTML as plain text"
    I then sent an email.
    "Intializing..." still displayed.
    In the log report... Type: views_send Message: message sent to myemail@mydomain.com
    However, the email was never received.

  • 🇳🇴Norway hansfn

    The question is really not about the settings when composing the e-mail, but if you have installed any MIME supporting mail modules.

    As viren18febS says, we can't reproduce this using the default PHP Mailer in Drupal.

    A side note, are you selecting "Send the message directly using the Batch API" (which is the default) when sending the mail?

  • 🇮🇳India viren18febS

    HI @hansfn
    It is worked for me with Default PHP mailer & i also checked for formatted e-mails with PHP mailer, its working and sent mail as plain text.
    when i have tried it with MIME mailer then got some other error which is related to with MIME mailer.

  • 🇳🇴Norway hansfn

    I have tested with D9 and D10 - without and with MimeMail, as user 1 and as content author (with "View user email addresses" permission). The only problem I have is that user tokens aren't replaced - everything else just works.

    So I need to know more about your view definition. Can you export config or explain? You can find my simple sample view in another issue 🐛 View Token Substitution does not work Active .

  • 🇺🇸United States gscerb

    My bad. I did a clean Drupal reinstall and was able to send emails without a problem. There must have been a misconfiguration somewhere along the line as I tested various options.

  • Status changed to Closed: works as designed 9 months ago
  • 🇳🇴Norway hansfn

    Maybe, or the problem was related to the actual data in the view.

    I'm closing the issue now and then you can reopen if you experience it again. Pay attention to the data

  • 🇨🇦Canada SKAUGHT

    @9.2
    https://www.drupal.org/project/drupal/issues/3258695 💬 Call to undefined method Symfony\Component\Mime\Header\Headers::addHeader() Closed: works as designed

  • 🇳🇴Norway hansfn

    Thanks for contributing to the issue, SKAUGHT, but I'm pretty confident this is different from the issue you posted. And it's not limited to Drupal 9.2. (If you look at the error message in the initial post, you'll notice that null is sent instead of a string. The function exists and so on.)

  • 🇨🇦Canada SKAUGHT

    (: no worry

    i put the wrong link in 15. it is cores' fault. cheers.
    https://www.drupal.org/node/3207439

  • 🇨🇦Canada SKAUGHT

    Marking title for PROJECT overview. thanks!

Production build 0.69.0 2024