Using PHP mail function to send attachment to submitted address

Hi,

Thank you for reading this post.

I am new to PHP so please excuse my lack of knowledge.

I have the following requirement and I was hoping someone would help with the code please.

I need HTML and PHP code that allows a user of the site to enter their email address select an attachment from a drop down list (files contained on the web server) and it will send the chosen file to the email address they have input.

I can’t figure out how to make the mail function work with the above scenario.

Please note I need to do this without an SMTP server.

Thank you.

I’m not going to write the code for you but I will recommend Swift Mailer. Here you can find the documentation for attaching files which is a complete pain in the arse without a library like Swift Mailer.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.