From 442f61a37ad52a686758874ae0ddaaabb2a67816 Mon Sep 17 00:00:00 2001 From: sergiu Date: Mon, 17 Feb 2025 13:27:31 +0200 Subject: [PATCH 1/5] updated readme Signed-off-by: sergiu --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index feeabf9..a8b754b 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,14 @@ ## dot-mail badges ![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/dot-mail) -![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/5.1.0) +![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/dot-mail/5.1.3) [![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/issues) [![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/network) [![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/stargazers) -[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/blob/5.1/LICENSE.md) +[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/blob/5.0/LICENSE.md) -[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml/badge.svg?branch=5.1)](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml) +[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml) [![codecov](https://codecov.io/gh/dotkernel/dot-mail/branch/5.0/graph/badge.svg?token=G51NEHYKD3)](https://codecov.io/gh/dotkernel/dot-mail) ## Installation From 211f9a7cac0199a74dd0562c9e94430b93509e6a Mon Sep 17 00:00:00 2001 From: sergiu Date: Mon, 17 Feb 2025 13:32:44 +0200 Subject: [PATCH 2/5] Issue-85: Fixed attachment not working issue Signed-off-by: sergiu --- src/Service/LogService.php | 5 ++++- src/Service/MailService.php | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Service/LogService.php b/src/Service/LogService.php index e919da7..93e43e4 100644 --- a/src/Service/LogService.php +++ b/src/Service/LogService.php @@ -4,6 +4,7 @@ namespace Dot\Mail\Service; +use DateTimeImmutable; use Dot\Mail\Email; use function date; @@ -56,7 +57,9 @@ public function sent(Email $message): false|int|null 'cc' => $this->extractAddresses($message->getCc()), 'bcc' => $this->extractAddresses($message->getBcc()), ]; - $data = sprintf('[%s]: %s' . PHP_EOL, date('Y-m-d H:i:s'), json_encode($data)); + + $date = new DateTimeImmutable(); + $data = sprintf('[%s]: %s' . PHP_EOL, $date->format('Y-m-d H:i:s'), json_encode($data)); /** * Write the log data and return the result diff --git a/src/Service/MailService.php b/src/Service/MailService.php index e10a540..f71be89 100644 --- a/src/Service/MailService.php +++ b/src/Service/MailService.php @@ -61,6 +61,7 @@ public function send(): ResultInterface //attach files before sending $this->attachFiles(); $this->getTransport()->send($this->getMessage()); + $this->getMessage()->setBody(null); $this->getEventManager()->triggerEvent($this->createMailEvent(MailEvent::EVENT_MAIL_POST_SEND, $result)); } catch (Exception $e) { @@ -102,7 +103,7 @@ public function attachFiles(): false|Email continue; } $basename = is_string($key) ? $key : basename($attachment); - $attachedFile = new DataPart($attachment, $basename, null); + $attachedFile = new DataPart(fopen($attachment, 'r'), $basename); $mimeMessage = new MixedPart($mimeMessage, $attachedFile); $this->message->setBody($mimeMessage); From 7df282f75ab93bbc4378bf3c3c40739632706fb3 Mon Sep 17 00:00:00 2001 From: sergiu Date: Mon, 17 Feb 2025 13:35:07 +0200 Subject: [PATCH 3/5] fixed readme Signed-off-by: sergiu --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a8b754b..a8182a8 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ [![GitHub issues](https://img.shields.io/github/issues/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/issues) [![GitHub forks](https://img.shields.io/github/forks/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/network) [![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/stargazers) -[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/blob/5.0/LICENSE.md) +[![GitHub license](https://img.shields.io/github/license/dotkernel/dot-mail)](https://github.com/dotkernel/dot-mail/blob/5.1/LICENSE.md) -[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml/badge.svg?branch=5.0)](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml) +[![Build Static](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml/badge.svg?branch=5.1)](https://github.com/dotkernel/dot-mail/actions/workflows/continuous-integration.yml) [![codecov](https://codecov.io/gh/dotkernel/dot-mail/branch/5.0/graph/badge.svg?token=G51NEHYKD3)](https://codecov.io/gh/dotkernel/dot-mail) ## Installation From b07e3dd5a873f931fca515aaa05353ddcd15ea54 Mon Sep 17 00:00:00 2001 From: sergiu Date: Mon, 17 Feb 2025 13:38:47 +0200 Subject: [PATCH 4/5] phpcs fix Signed-off-by: sergiu --- src/Service/MailService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Service/MailService.php b/src/Service/MailService.php index f71be89..34e35ac 100644 --- a/src/Service/MailService.php +++ b/src/Service/MailService.php @@ -22,6 +22,7 @@ use function array_merge; use function basename; use function count; +use function fopen; use function is_file; use function is_string; From e0206e7e762f6c94f3eed01d59207b9ff270a038 Mon Sep 17 00:00:00 2001 From: sergiu Date: Mon, 17 Feb 2025 13:52:45 +0200 Subject: [PATCH 5/5] unnecesarry use --- src/Service/LogService.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Service/LogService.php b/src/Service/LogService.php index 93e43e4..02e4290 100644 --- a/src/Service/LogService.php +++ b/src/Service/LogService.php @@ -7,7 +7,6 @@ use DateTimeImmutable; use Dot\Mail\Email; -use function date; use function dirname; use function file_exists; use function file_put_contents;