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
Path is not readable - mime\Part\TextPart checks if a directory is a directory and then throws #54767
Comments
Symfony 6.3 does not receive bugfixes anymore. If you still see the same behaviour with Symfony 6.4 or higher, please create a small example application that allows to reproduce it. |
It still behaves the same in the latest version. Here is a reproduction: https://github.com/KevsRepos/symfony-mime-bug-reproduction I would really like to know if I am just doing something wrong, or if this really doesnt make any sense. |
I think there is a misunderstanding. The file path must be the full path including the base filename. The (optional) filename argument is there to be able to use independent filenames for how the file is stored to what is presented to the recipient of the e-mail. |
That's very misleading, but you're right. Thanks. I think the class signature should clarify that it is expecting the full path including the file name. /**
* @param string $fullPath must have file name included
* @param ?string $newFileName name to use for e-mail attachments
* / |
PR welcome to clarify this |
Symfony version(s) affected
6.3
Description
Error is thrown that
/var/www/html/foo/bar
is not readable when trying to attach a file to an email.How to reproduce
Using symfonys mailer to create a mail and attach a file:
symfony will do as follows:
attach
method fromSymfony\Component\Mime
$this->addPart
withSymfony\Component\Mime\Part\DataPart
as its argumentDataPart
DataPart
constructs its parentTextPart
TextPart
then does something confusing:It gets the containing directory into
$path
and then checks if this path is a directory, which it just logically has to be and then the error is thrown.Possible Solution
Dont check if a directory is a directory, please check instead if a file is a directory.
Additional Context
No response
The text was updated successfully, but these errors were encountered: