Compare commits
No commits in common. "main" and "1.0" have entirely different histories.
21
LICENSE
21
LICENSE
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 BlUESQUARE COMPUTING
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -8,7 +8,7 @@ Ajouter à `composer.json` :
|
|||
|
||||
```
|
||||
"require": {
|
||||
"bluesquare/laravel-mail-templates": "^1.4"
|
||||
"bluesquare/laravel-mail-templates": "^1.0"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"email"
|
||||
],
|
||||
"homepage": "https://git.bluesquare.io/bluesquare/laravel-mail-templates",
|
||||
"license": "MIT",
|
||||
"license": "proprietary",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Bluesquare",
|
||||
|
@ -18,7 +18,7 @@
|
|||
"role": "Developers"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "stable",
|
||||
"minimum-stability": "dev",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Bluesquare\\MailTemplates\\": "src/"
|
||||
|
|
|
@ -68,7 +68,7 @@ class MailTemplate implements \JsonSerializable
|
|||
*/
|
||||
public function sender(string $address, string $name = null): MailTemplate
|
||||
{
|
||||
$this->sender['email'] = $address;
|
||||
$this->sender['address'] = $address;
|
||||
|
||||
if (! empty($name))
|
||||
$this->sender['name'] = $name;
|
||||
|
@ -83,7 +83,7 @@ class MailTemplate implements \JsonSerializable
|
|||
*/
|
||||
public function replyTo(string $address, string $name = null): MailTemplate
|
||||
{
|
||||
$this->replyTo['email'] = $address;
|
||||
$this->replyTo['address'] = $address;
|
||||
|
||||
if (! empty($name))
|
||||
$this->replyTo['name'] = $name;
|
||||
|
@ -97,13 +97,11 @@ class MailTemplate implements \JsonSerializable
|
|||
*/
|
||||
public function recipients(array $recipients): MailTemplate
|
||||
{
|
||||
$this->recipients = [];
|
||||
|
||||
if (! empty($recipients)) {
|
||||
if (!empty($recipients)) {
|
||||
foreach ($recipients as $recipient) {
|
||||
if (!empty($recipient[0]) && is_string($recipient[0])) {
|
||||
$data = [
|
||||
'email' => $recipient[0]
|
||||
'address' => $recipient[0]
|
||||
];
|
||||
|
||||
if (!empty($recipient[1])) {
|
||||
|
@ -130,7 +128,7 @@ class MailTemplate implements \JsonSerializable
|
|||
public function addRecipient(string $address, array $informations = []): MailTemplate
|
||||
{
|
||||
$data = [
|
||||
'email' => $address
|
||||
'address' => $address
|
||||
];
|
||||
|
||||
if (!empty($informations)) {
|
||||
|
@ -162,7 +160,7 @@ class MailTemplate implements \JsonSerializable
|
|||
public function attachments(array $attachments): MailTemplate
|
||||
{
|
||||
foreach ($attachments as $attachment) {
|
||||
$this->addAttachment($attachment['url'] ?? $attachment['path'] ?? $attachment['file'], $attachment['filename'] ?? null);
|
||||
$this->addAttachment($attachment['path'] ?? $attachment['file'], $attachment['filename'] ?? null);
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
|
|
@ -53,6 +53,10 @@ class SendinblueProvider implements TemplateMailProvider
|
|||
if ($data['replyTo'])
|
||||
$model->setReplyTo(new SendSmtpEmailReplyTo($data['replyTo']));
|
||||
|
||||
$model->setTo(array_map(function ($to) {
|
||||
return new SendSmtpEmailTo($to);
|
||||
}, $data['recipients']));
|
||||
|
||||
if (! empty($config['redirect'])) {
|
||||
Log::info("Redirecting SIB mail to: " . $config['redirect']);
|
||||
$model->setTo([
|
||||
|
@ -61,31 +65,12 @@ class SendinblueProvider implements TemplateMailProvider
|
|||
])
|
||||
]);
|
||||
}
|
||||
elseif (count($data['recipients']) == 0 && ! empty($notifiable?->email)) {
|
||||
$model->setTo([
|
||||
new SendSmtpEmailTo([
|
||||
'email' => $notifiable->email
|
||||
])
|
||||
]);
|
||||
}
|
||||
else {
|
||||
$model->setTo(array_map(function ($to) {
|
||||
return new SendSmtpEmailTo($to);
|
||||
}, $data['recipients']));
|
||||
}
|
||||
|
||||
if (! empty($data['attachments'])) {
|
||||
$model->setAttachment(array_map(function ($item) {
|
||||
$attachment = new SendSmtpEmailAttachment();
|
||||
|
||||
if (isset($item['filename']))
|
||||
$attachment->setName($item['filename']);
|
||||
|
||||
if (strpos($item['path'], 'http') === 0)
|
||||
$attachment->setUrl($item['path']);
|
||||
else
|
||||
$attachment->setContent(file_get_contents($item['path']));
|
||||
|
||||
return $attachment;
|
||||
}, $data['attachments']));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue