mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
add mms files to mail transfert
This commit is contained in:
parent
d29424ff0c
commit
e06079e6af
5 changed files with 17 additions and 5 deletions
|
@ -101,10 +101,11 @@ class Mailer extends \descartes\Controller
|
|||
* @param string $destination : email address to send email to
|
||||
* @param array $settings : Email settings
|
||||
* @param array $data : Data to inject into email template
|
||||
* @param array $attachments : List of paths of files to attach to the mail
|
||||
*
|
||||
* @return bool : true on success, false on error
|
||||
*/
|
||||
public function enqueue(string $destination, array $settings, array $data): bool
|
||||
public function enqueue(string $destination, array $settings, array $data, array $attachments = []): bool
|
||||
{
|
||||
$response = $this->generate_body($settings, $data);
|
||||
|
||||
|
@ -113,6 +114,7 @@ class Mailer extends \descartes\Controller
|
|||
'subject' => $settings['subject'],
|
||||
'body' => $response['body'],
|
||||
'alt_body' => $response['alt_body'],
|
||||
'attachments' => $attachments,
|
||||
];
|
||||
|
||||
$error_code = null;
|
||||
|
|
|
@ -291,12 +291,20 @@ namespace controllers\internals;
|
|||
}
|
||||
|
||||
$mailer = new Mailer();
|
||||
|
||||
$attachments = [];
|
||||
|
||||
foreach ($received['medias'] ?? [] as $media)
|
||||
{
|
||||
$attachments[] = PWD_DATA_PUBLIC . '/' . $media['path'];
|
||||
}
|
||||
|
||||
return $mailer->enqueue($user['email'], EMAIL_TRANSFER_SMS, [
|
||||
'at' => $received['at'],
|
||||
'origin' => $received['origin'],
|
||||
'destination' => $phone['name'],
|
||||
'text' => $received['text'],
|
||||
]);
|
||||
'mms' => $received['mms'] ?? false,
|
||||
], $attachments);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue