Getting file upload from AWS S3

Hey

So i use Amazon S3 upload file to store uploaded Files,

Now what im trying to do is  a custom attach document to a email which i am using phpmailer to attach, my issue is im not sure how to get the file from Amazon S3 and attach it to the PHPMailer.

I have only front end and jq setup, where you click on a attachment which sends a ajax request to the backend which uses a file path to go to the S3 but im not sure how to bring back the file to pass into phpMailer.

any tips or advice ?
Alex LordAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
To accomplish this, "Now what im trying to do is  a custom attach document to a email which i am using phpmailer to attach, my issue is im not sure how to get the file from Amazon S3 and attach it to the PHPMailer."

You will do this...

1) No mail client has the ability to access an S3 asset, so you must make this asset available to mail clients.

2) If the asset is large, you'll download it from S3 to some public facing Website + reference the URL in your email.

3) If the asset is small, you'll download it from S3 to local storage, then embed an inline version of the asset in your email, then delete the local asset when you're finished sending your email.
Julian HansenCommented:
There is a PHP Wrapper class that allows you to interact with S3 to get files you can find it here
https://www.phpclasses.org/package/4144-PHP-Stream-wrapper-to-get-and-send-files-to-Amazon-S3.html

I have not used it but it appears to cater for what you need to do

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.