Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
WE.SwiftMailerSpool
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Labels
Merge Requests
0
Merge Requests
0
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
packages
WE.SwiftMailerSpool
Commits
e44c7beb
Commit
e44c7beb
authored
Jan 28, 2016
by
Simon Gadient
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IMP] Add a logger to the spool command
refs KIME-3340
parent
80eecf34
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
4 deletions
+48
-4
Classes/WE/SwiftMailerSpool/Command/SwiftMailerSpoolCommandController.php
...MailerSpool/Command/SwiftMailerSpoolCommandController.php
+13
-2
Classes/WE/SwiftMailerSpool/Log/SwiftMailerSpoolLoggerInterface.php
.../SwiftMailerSpool/Log/SwiftMailerSpoolLoggerInterface.php
+20
-0
Configuration/Objects.yaml
Configuration/Objects.yaml
+13
-0
README.md
README.md
+2
-2
No files found.
Classes/WE/SwiftMailerSpool/Command/SwiftMailerSpoolCommandController.php
View file @
e44c7beb
...
...
@@ -40,6 +40,12 @@ class SwiftMailerSpoolCommandController extends CommandController {
*/
protected
$configurationManager
;
/**
* @Flow\Inject
* @var \WE\SwiftMailerSpool\Log\SwiftMailerSpoolLoggerInterface
*/
protected
$logger
;
/**
* Flush the email spool queue
*
...
...
@@ -50,8 +56,13 @@ class SwiftMailerSpoolCommandController extends CommandController {
$realTransport
=
$this
->
transportFactory
->
create
(
$settings
[
'transport'
][
'type'
],
$settings
[
'transport'
][
'options'
],
$settings
[
'transport'
][
'arguments'
]);
/** @var \Swift_Spool $spool */
$spool
=
$this
->
spoolMailer
->
getTransport
()
->
getSpool
();
$sent
=
$spool
->
flushQueue
(
$realTransport
);
$this
->
outputLine
(
$sent
.
' mails sent'
);
$failedRecipients
=
array
();
$sent
=
$spool
->
flushQueue
(
$realTransport
,
$failedRecipients
);
$this
->
logger
->
log
(
$sent
.
' mails sent.'
);
$count
=
count
(
$failedRecipients
);
if
(
$count
>
0
)
{
$this
->
logger
->
log
(
$count
.
' recipients failed. Check the spool to see the messages.'
,
LOG_WARNING
);
}
}
}
Classes/WE/SwiftMailerSpool/Log/SwiftMailerSpoolLoggerInterface.php
0 → 100644
View file @
e44c7beb
<?php
namespace
WE\SwiftMailerSpool\Log
;
/* *
* This script belongs to the Flow package "SwiftMailerSpool". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
* The TYPO3 project - inspiring people to share! *
* */
/**
* Logger interface for the SwiftMailerSpool package
*
* @author Simon Gadient <simon@web-essentials.asia>
*/
interface
SwiftMailerSpoolLoggerInterface
extends
\TYPO3\Flow\Log\LoggerInterface
{
}
Configuration/Objects.yaml
View file @
e44c7beb
...
...
@@ -13,3 +13,16 @@ TYPO3\SwiftMailer\MailerInterface:
arguments
:
1
:
object
:
WE\SwiftMailerSpool\SpoolTransportInterface
WE\SwiftMailerSpool\Log\SwiftMailerSpoolLoggerInterface
:
scope
:
singleton
factoryObjectName
:
TYPO3\Flow\Log\LoggerFactory
arguments
:
1
:
value
:
'
SystemLogger'
2
:
setting
:
TYPO3.Flow.log.systemLogger.logger
3
:
setting
:
TYPO3.Flow.log.systemLogger.backend
4
:
setting
:
TYPO3.Flow.log.systemLogger.backendOptions
README.md
View file @
e44c7beb
...
...
@@ -15,8 +15,8 @@ The package is pre-configured to use a the file spool:
## Usage
Different from the
[
Neos Swift Mailer
](
https://github.com/neos/swiftmailer
)
, a
`\Swift_Message`
has to be created instead
of using the
`\TYPO3\SwiftMailer\Message`
object. This is due to a problem
s
on the serialization of the message that
happens in the
`\FileSpool`
as the serialized
`\TYPO3\SwiftMailer\Message`
does not include its parent properties of the
of using the
`\TYPO3\SwiftMailer\Message`
object. This is due to a problem on the serialization of the message that
happens in the
`\FileSpool`
as the serialized
`\TYPO3\SwiftMailer\Message`
does not include its p
rivate p
arent properties of the
`\Swift_Message`
.
The process is the same as with the normal SwiftMailer library.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment