Help with sending emails with attached files #1292
Answered
by
AIC-BV
valentesolucoes
asked this question in
Q&A
|
Hello friends, I'm a little lost in the WinterCMS documentation, about how to attach files from a form on the Frontend by email. In this form, I can send several files (.pdf, .doc or .jpg). In the Plugin that I created on the Backend, I receive the form data as follows: My Frontend form: However, when I process the attachment of files to the form and click submit, nothing happens. I believe that some parameter is missing. Does anyone have an example of how to do this? |
Answered by
AIC-BV
Jan 22, 2025
Replies: 2 comments 8 replies
|
@valentesolucoes try adding the |
1 reply
|
@valentesolucoes you might have to attach each individual files seperately.
Mail::send('frontend::mail.attachments', $params, function ($message) use ($params) {
$message->to('me@gmail.com', '');
foreach($params['files'] as $file) {
$message->attach($file, ['as' => $file->getClientOriginalName()]);
}
} |
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have this code
I notice your name does not have the array notation []: https://wintercms.com/docs/v1.2/docs/database/attachments#:~:text=%3Cinput%20type%3D%27file%27%20name%3D%27files%5B%5D%27%20multiple%3E (i've had this issue in the past too)