Created
December 12, 2019 14:02
-
-
Save rpayanm/99f85605ea377983693642cfc236f3d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_mail(). | |
*/ | |
function MY_MODULE_mail($key, &$message, $params) { | |
if ($key == 'MY_KEY') { | |
$fid = 4; // For example | |
$file = File::load($fid); | |
$message['params']['attachments'][] = [ | |
'filename' => $file->getFilename(), | |
'filepath' => $file->getFileUri(), | |
'filemime' => $file->getMimeType(), | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment