Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown TypeError when MailerHelper::createTransportAdapter is initializing #4552

Closed
romainpoirier opened this issue Jul 12, 2019 · 5 comments

Comments

@romainpoirier
Copy link

commented Jul 12, 2019

Description

Argument 1 passed to craft\helpers\MailerHelper::createTransportAdapter() must be of the type string, null given, called in /vendor/craftcms/cms/src/controllers/SystemSettingsController.php on line 141

Steps to reproduce

  1. Visit /admin/settings/email, error is shown
  2. Alternatively, cache/flush-all command return the same kind of error: Exception 'TypeError' with message 'Argument 1 passed to craft\helpers\MailerHelper::createTransportAdapter() must be of the type string, null given, called in /vendor/craftcms/cms/src/helpers/App.php on line 447' in /vendor/craftcms/cms/src/helpers/MailerHelper.php:85
  3. This also happens after craftcms/mandrill package is removed using composer remove craftcms/mandrill.

Additional info

  • Craft version: Craft Pro 3.2.1
  • PHP version: 7.2.20
  • Database driver & version: MySQL 5.5.5
  • Plugins & versions: Control Panel CSS 2.2.0, Control Panel JS 2.2.0, Dumper 2.0.0, Element API 2.5.4, Embedded Assets 2.0.10, Expanded Singles 1.0.7, Forms 3.2.1, Imager v2.1.10, Mandrill 1.3.1, Minify 1.2.9, Neo 2.3.5, Redactor 2.3.3.2, Retcon 2.0.12, Retour 3.1.17, SEO 3.2.13, Typogrify 1.1.18
@brandonkelly

This comment has been minimized.

Copy link
Member

commented Jul 14, 2019

Do you have a custom mailer component defined in config/app.php?

@romainpoirier

This comment has been minimized.

Copy link
Author

commented Jul 15, 2019

No, I haven't.

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Jul 15, 2019

I can’t reproduce this; if I use a custom mailer plugin such as Mandrill, and then composer-remove the package, all I get on the Settings → Email page is a validation error below the Transport Type setting (“The transport type “” could not be found.”), but otherwise the page loads normally.

Can you please send your composer.json and composer.lock files, and a database backup, over to support@craftcms.com?

@romainpoirier

This comment has been minimized.

Copy link
Author

commented Jul 16, 2019

I finally found that these lines were missing in the project.yaml file:

email:
fromEmail: $SYSTEM_EMAIL_ADDRESS
fromName: $SENDER_NAME
template: $HTML_EMAIL_TEMPLATE
transportType: craft\mandrill\MandrillAdapter
transportSettings:
apiKey: $MANDRILL_API_KEY
subaccount: ''

The Settings → Email page had no configuration saved so it was displaying this error. Before to add these lines to the project.yaml file, I didn't found any reference to the email settings in the database.

This was probably linked to my project.yaml version error (#4546).

@brandonkelly

This comment has been minimized.

Copy link
Member

commented Jul 16, 2019

Aha! Was able to reproduce after deleting that. Just fixed this for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.