Bug #93196
closedMail API, ArgumentCountError
0%
Description
I tried to use the Mail API, Version 10.4.12
1. Admin Tools / Environment / Test Mail Setup:
Result: no email, no error message, nothing ...
2. Test as follows: (Send email with MailMessage)
GeneralUtility::makeInstance(MailMessage::class)
->from(new Address('mySender@myServer.ch', 'myCompany'))
->to(new Address('me.me@provider.ch', 'me'))
->replyTo('mySender@myServer.ch')
->subject('Wakeup reminder')
->text('Hi, I wrote you a slack message.')
->html('<h4>Hi</h4><p>I wrote you an interesting slack message.</p>')
->send();
Result: email received, everything OK
3. Test as follows: (Send email with FluidEmail)
$email = GeneralUtility::makeInstance(FluidEmail::class);
$email
->to(new Address('me.me@provider.ch', 'me'))
->from(new Address('mySender@myServer.ch', 'myCompany'))
->subject('Message')
->format('html') // only HTML mail
->setTemplate('Default');
GeneralUtility::makeInstance(Mailer::class)->send($email);
Result:
(1/1) ArgumentCountError
Too few arguments to function Symfony\Component\Mailer\Mailer::__construct(), 0 passed in /home/.../www/.../typo3_src-10.4.12/typo3/sysext/core/Classes/Utility/GeneralUtility.php on line 3431 and at least 1 expected
My settings:
LocalConfiguration.php
'MAIL' => [
'layoutRootPaths' => [
'EXT:core/Resources/Private/Layouts/',
'EXT:backend/Resources/Private/Layouts/',
],
'templateRootPaths' => [
'EXT:core/Resources/Private/Templates/Email/',
'EXT:backend/Resources/Private/Templates/Email/',
],
'transport' => 'sendmail',
'transport_sendmail_command' => '/usr/sbin/sendmail -t -i',
],
Files
Updated by Mayer Patrick almost 4 years ago
- Category changed from Miscellaneous to Documentation
- Tags changed from Mail API to Mail API documentation
On docs.typo3.org (https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/Mail/Index.html) the documentation regarding Mail API is misleading.
This keyword is wrong: use Symfony\Component\Mailer\Mailer;
The correct keyword is: use TYPO3\CMS\Core\Mail\Mailer;
Using the correct keyword solves the problem.
The documentation must be adapted accordingly.
Updated by Mayer Patrick almost 4 years ago
PR on github done today
Issue can be closed now
Updated by Simon Gilli almost 4 years ago
- Status changed from New to Resolved