I want to change the attachment that is sent on an automated email by selecting the filename from a table. In simple form I want to do this.
$filename = DataObject::get_by_id("MonkeysFist","ID=1");
$emailToSubmiter->attachFile('assets/Uploads/mf_attachments/'$filename.FileName, '$filename.FileName');
I know I have a couple of problems with this because even if I use
$emailToSubmiter->attachFile('assets/Uploads/mf_attachments/test.pdf, $filename.FileName);
The filename is given as FileName rather than its actual value.
Any thoughts, thanks
MM