0

I am getting data in the following format through post request.

"data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="

Now I want to send this 'data:image/png;base64' value as an image(jpg/png) to email as email attachment.

I am using JFactory::getMailer();.

Can you guide me on how I can do it?

3
  • Welcome to JSE. Please take our tour and consider editing your profile to tell us a bit about your Joomla story. Commented Sep 11, 2020 at 15:31
  • Can you just provide a bit of clarification? Is the base64 string the base64-encoded URL of the image? And do you have to provide the image as an attachment in the email rather than just including a link in the email? To provide it as an attachment I think you'll need to make an HTTP request out to its URL and copy it to the Joomla server, and then you can include it as an attachment. Have you looked at that at all (eg using the php curl library?) Commented Sep 12, 2020 at 21:32
  • You have to be very careful with doing all this sort of thing though - very easy for some hacker to send a POST like that to your server and you end up emailing his malware to someone, disguised as an image. Commented Sep 12, 2020 at 21:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.