Project

General

Profile

Actions

Bug #93196

closed

Mail API, ArgumentCountError

Added by Mayer Patrick almost 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Documentation
Target version:
-
Start date:
2020-12-31
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.3
Tags:
Mail API documentation
Complexity:
Is Regression:
Sprint Focus:

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

stacktrace.txt (1.76 KB) stacktrace.txt Mayer Patrick, 2020-12-31 15:04
Actions #1

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.

Actions #2

Updated by Simon Gilli almost 4 years ago

  • Assignee set to Simon Gilli
Actions #3

Updated by Mayer Patrick almost 4 years ago

PR on github done today
Issue can be closed now

Actions #4

Updated by Simon Gilli almost 4 years ago

  • Status changed from New to Resolved
Actions #5

Updated by Benni Mack almost 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF