From b0512fc19c9574f001ec02e37da021790f26a910 Mon Sep 17 00:00:00 2001 From: MarioRadu Date: Tue, 10 Dec 2024 00:48:53 +0200 Subject: [PATCH] implemented dotkernel/dot-mail 5.0 Signed-off-by: MarioRadu --- composer.json | 2 +- config/autoload/mail.local.php.dist | 102 ++++++++++++---------------- 2 files changed, 46 insertions(+), 58 deletions(-) diff --git a/composer.json b/composer.json index b166e79..f12aa84 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "dotkernel/dot-flashmessenger": "^3.4.2", "dotkernel/dot-geoip": "^3.6.0", "dotkernel/dot-helpers": "^3.4.2", - "dotkernel/dot-mail": "^4.1.1", + "dotkernel/dot-mail": "^5.1.0", "dotkernel/dot-navigation": "^3.4.2", "dotkernel/dot-rbac-guard": "^3.4.2", "dotkernel/dot-session": "^5.6.0", diff --git a/config/autoload/mail.local.php.dist b/config/autoload/mail.local.php.dist index 79bad53..9ef3b30 100644 --- a/config/autoload/mail.local.php.dist +++ b/config/autoload/mail.local.php.dist @@ -4,47 +4,38 @@ declare(strict_types=1); return [ /** - * Dk mail module configuration - * Note that many of these options can be set programmatically too, - * when sending mail messages actually that is what you'll usually do, - * these configs provide just default and options that remain the same for all mails + * Dotkernel mail module configuration + * Note that many of these options can be set programmatically too, when sending mail messages actually that is + * what you'll usually do, these configs provide just defaults and options that remain the same for all mails */ 'dot_mail' => [ -// the key is the mail service name, this is the default one, which does not extend any configuration + //the key is the mail service name, this is the default one, which does not extend any configuration 'default' => [ -// tells which other mail service configuration to extend - 'extends' => null, - /** - * the mail transport to use - * can be any class implementing Laminas\Mail\Transport\TransportInterface - * - * for standard mail transports, you can use these aliases - * - sendmail => Laminas\Mail\Transport\Sendmail - * - smtp => Laminas\Mail\Transport\Smtp - * - file => Laminas\Mail\Transport\File - * - in_memory => Laminas\Mail\Transport\InMemory - * - * defaults to sendmail - **/ - 'transport' => Laminas\Mail\Transport\Sendmail::class, - // Uncomment the below line if you want to save a copy of all sent emails to a certain IMAP folder - // Valid only if the Transport is SMTP -// 'save_sent_message_folder' => ['INBOX.Sent'], -// message configuration + //message configuration 'message_options' => [ - 'from' => '', - 'from_name' => 'Dotkernel', - 'reply_to' => '', + //from email address of the email + 'from' => '', + //from name to be displayed instead of from address + 'from_name' => '', + //reply-to email address of the email + 'reply_to' => '', + //replyTo name to be displayed instead of the address 'reply_to_name' => '', - 'to' => [], - 'cc' => [], - 'bcc' => [], - 'subject' => '', - 'body' => [ + //destination email address as string or a list of email addresses + 'to' => [], + //copy destination addresses + 'cc' => [], + //hidden copy destination addresses + 'bcc' => [], + //email subject + 'subject' => '', + //body options - content can be plain text, HTML + 'body' => [ 'content' => '', 'charset' => 'utf-8', ], - 'attachments' => [ + //attachments config + 'attachments' => [ 'files' => [], 'dir' => [ 'iterate' => false, @@ -53,40 +44,37 @@ return [ ], ], ], -// options that will be used only if Laminas\Mail\Transport\Smtp adapter is used + /** + * the mail transport to use can be any class implementing + * Symfony\Component\Mailer\Transport\TransportInterface + * + * for standard mail transports, you can use these aliases: + * - sendmail => Symfony\Component\Mailer\Transport\SendmailTransport + * - esmtp => Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport + * + * defaults to sendmail + **/ + 'transport' => 'sendmail', + //options that will be used only if esmtp adapter is used 'smtp_options' => [ - 'host' => '', + //hostname or IP address of the mail server + 'host' => '', + //port of the mail server - 587 or 465 for secure connections 'port' => 587, - 'connection_class' => 'login', 'connection_config' => [ + //the smtp authentication identity 'username' => '', + //the smtp authentication credential 'password' => '', - 'ssl' => 'ssl', + //to disable auto_tls set tls key to false + //it's not recommended to disable TLS while connecting to an SMTP server + 'tls' => null, ], ], -// file options that will be used only if the adapter is Laminas\Mail\Transport\File -// 'file_options' => [ -// 'path' => 'data/mail/output', -// //a callable that will get the Laminas\Mail\Transport\File object as an argument -// //and should return the filename if null is used, and empty callable will be used -// 'callback' => null, -// ], -// listeners to register with the mail service, for mail events - 'event_listeners' => [ -// [ -// 'type' => 'service or class name', -// 'priority' => 1, -// ], - ], ], -// option to log the SENT emails + // option to log the SENT emails 'log' => [ 'sent' => getcwd() . '/log/mail/sent.log', ], - - /** - * You can define other mail services here, with the same structure as the default block - * you can even extend from the default block, and overwrite only the differences - */ ], ];