A repeat on an earlier issue, changing to
$fn = DataObject::get_by_id("MonkeysFist", 7);
$filepath = "assets/Uploads/mf_attachments/$fn->MFFileName";
$emailToSubmiter->attachFile($filepath, $fn->MFFileName);
Fixes it
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
A repeat on an earlier issue, changing to
$fn = DataObject::get_by_id("MonkeysFist", 7);
$filepath = "assets/Uploads/mf_attachments/$fn->MFFileName";
$emailToSubmiter->attachFile($filepath, $fn->MFFileName);
Fixes it
Bizarre stuff, indeed. If any other attachments get cheeky you may want to get a little more hands on and ensure the encoding, contents, and mime type are specified. With certain finicky MUAs out there, sometimes you must apply some thorough beatings until they yield.
An example from the codes:
$email = new Email();
$email->attachments[] = array(
'filename' => BASE_PATH . "/themes/mytheme/images/header.gif",
'contents' => file_get_contents(BASE_PATH . "/themes/mytheme/images/header.gif"),
'mimetype' => 'image/gif',
'contentLocation' => Director::absoluteBaseURL() . "/themes/mytheme/images/header.gif"
);