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


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?

  • Welcome to JSE. Please take our tour and consider editing your profile to tell us a bit about your Joomla story.
    – mickmackusa
    Sep 11 '20 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?) Sep 12 '20 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. Sep 12 '20 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.