Email with attachement?

I have got my contact form working using the google smtp as a server.

But now i want emails to be sent with an attachment.

i know there is a input file type to let users select fiels from there PC. but how to save upload them and them send it with the email?


Did you look at this: ?

This has never been tried actually. The Email plugin is capable of handling attachments, but sending the file input added to a form as an attachment is something that must be taken care of, not yet implemented / tested.

Can you open an issue on the Email plugin so we don’t lose track of it?

issue created.

i did look into the form tutorial. strainge thing is I enabled file upload. but it is not uploading the picture… and it first need to upload pictures before i can send them as an attachement.

so basicly i need 2 things:

  1. upload a file
  2. find that file and send it with the email

1st thing fixed: i needed to add: enctype=“multipart/form-data” into the the form.html.twig template. now the file is uploading properly

next step is to attach the file with the email :wink:

Yes that is already taken care by the default form.html.twig provided in the Form plugin. If your theme overrides it, you need to update it too.

i am not sure how to add an attachment with sending an email i thought some like this:
attachments: {{ @self.form.field.file }} but that is not working