Skip to main content

Dynamically attach file to email

More
5 years 23 hours ago #336120 by lousyfool
-- HikaShop version -- : 4.4.3
-- Joomla version -- : 3.10
-- PHP version -- : 7.4

Hi,

I need to dynamically attach a file to the "order administrator notification" email.

I imagine I could simply add something like
Code:
$xyz->AddAttachment($filename);
to the preload PHP, correct?

I have no trouble setting/getting $filename, but what should "xyz" be?

Thanks for a hint.

Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

Please Log in or Create an account to join the conversation.

More
5 years 17 hours ago #336125 by nicolas
Hi,

You should be able to do it like that:
Code:
$attachment = new stdClass(); $attachment->filename = $filename; $mail->attachments = array($attachment);
The following user(s) said Thank You: lousyfool

Please Log in or Create an account to join the conversation.

More
5 years 14 hours ago #336145 by lousyfool
Hi Nicolas,

Excellent -- works great! And with this in hand it was easy to attach multiple files, too... :)

Merci mille fois!

Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.216 seconds
Powered by Kunena Forum