Report sent and failed emails as part of server status

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/ec/trunk@37038 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-09-04 08:07:02 +00:00
parent 8b45d10ad8
commit 1b3b490941
2 changed files with 10 additions and 3 deletions

View file

@ -324,6 +324,8 @@
NSString *eHost; /** Host with SMTP MTA */
NSString *ePort; /** Port of SMTP MTA */
GSMimeSMTPClient *smtp; /** Client connection to MTA */
NSUInteger sentEmail;
NSUInteger failEmail;
BOOL debug; /** Debug enabled in config */
BOOL supersede; /** If a clear should replace original */
BOOL eThreaded; /** alarm reminder emails threaded */

View file

@ -190,11 +190,13 @@ replaceFields(NSDictionary *fields, NSString *template)
- (void) smtpClient: (GSMimeSMTPClient*)client mimeFailed: (GSMimeDocument*)doc
{
failEmail++;
NSLog(@"Message failed: %@", doc);
}
- (void) smtpClient: (GSMimeSMTPClient*)client mimeSent: (GSMimeDocument*)doc
{
sentEmail++;
if (YES == debug)
{
NSLog(@"Message sent: %@", doc);
@ -203,6 +205,7 @@ replaceFields(NSDictionary *fields, NSString *template)
- (void) smtpClient: (GSMimeSMTPClient*)client mimeUnsent: (GSMimeDocument*)doc
{
failEmail++;
NSLog(@"Message dropped on SMTP client shutdown: %@", doc);
}
@ -363,9 +366,11 @@ replaceFields(NSDictionary *fields, NSString *template)
- (NSString*) description
{
return [NSString stringWithFormat: @"%@ -\nConfigured with %u rules\n"
@"With SMTP %@:%@ as %@\nPending Email:%@\nPending SMS:%@",
@"With SMTP %@:%@ as %@\n"
@"Email sent: %"PRIuPTR", fail: %"PRIuPTR", pending:%@\n"
@"SMS pending:%@",
[super description], (unsigned)[rules count], eHost, ePort,
eFrom, email, sms];
eFrom, sentEmail, failEmail, email, sms];
}
- (void) flushEmailForAddress: (NSString*)address
@ -429,7 +434,7 @@ replaceFields(NSDictionary *fields, NSString *template)
- (void) flushSms
{
return;
[sms removeAllObjects];
}
- (void) applyRules: (NSArray*)rulesArray