mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
FIX Update email attachment API for recipients and improve if statement readability
This commit is contained in:
parent
5695c9585a
commit
515f1923ba
@ -7,7 +7,6 @@ use SilverStripe\Assets\File;
|
|||||||
use SilverStripe\Assets\Upload;
|
use SilverStripe\Assets\Upload;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Email\Email;
|
use SilverStripe\Control\Email\Email;
|
||||||
use SilverStripe\Control\HTTP;
|
|
||||||
use SilverStripe\Control\HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Core\Manifest\ModuleLoader;
|
use SilverStripe\Core\Manifest\ModuleLoader;
|
||||||
use SilverStripe\Forms\Form;
|
use SilverStripe\Forms\Form;
|
||||||
@ -293,14 +292,15 @@ JS
|
|||||||
|
|
||||||
if ($attachments) {
|
if ($attachments) {
|
||||||
foreach ($attachments as $file) {
|
foreach ($attachments as $file) {
|
||||||
if (!$file->ID != 0) {
|
/** @var File $file */
|
||||||
|
if ((int) $file->ID === 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$email->attachFile(
|
$email->addAttachmentFromData(
|
||||||
$file->Filename,
|
$file->getString(),
|
||||||
$file->Filename,
|
$file->getFilename(),
|
||||||
HTTP::get_mime_type($file->Filename)
|
$file->getMimeType()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user