Expand my Community achievements bar.

Day CQ Mail Service not Spooling SMTP Messages on Demand

Avatar

Level 2

Hi,

Apparently, the mail service (configuration attached) runs on a timer?  My test emails are all processed as a batch several hours after sending.  How do I configure the mail service to run on-demand, i.e. send the email immediately rather than grouped as a batch?  I am running the 6.2 OSGI install on a Mac Book Pro (el capitan).  Here is debug output from stdout.log related to email processing (everything appears to be working correctly):

DEBUG: JavaMail version 1.5.0-b01
DEBUG: DEBUG: Bundle '296' META-INF/javamail.providers not found by javax.mail [296]
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Oracle], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Oracle], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: DEBUG: Bundle '296' META-INF/javamail.address.map not found by javax.mail [296]
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "127.0.0.1", port 25, isSSL false
220 wolff-OSX SMTP Server (JAMES SMTP Server 2.3.2.1) ready Sun, 2 Oct 2016 08:38:31 -0500 (CDT)
DEBUG SMTP: connected to host "127.0.0.1", port: 25

EHLO fe80:0:0:0:3e15:c2ff:febf:eb4e%4
250-wolff-OSX Hello fe80:0:0:0:3e15:c2ff:febf:eb4e%4 (localhost [127.0.0.1])
250-PIPELINING
250 ENHANCEDSTATUSCODES
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<admin@geometrixx-gov.com>
250 2.1.0 Sender <admin@geometrixx-gov.com> OK
RCPT TO:<srose@geometrixx.info>
250 2.1.5 Recipient <srose@geometrixx.info> OK
DEBUG SMTP: Verified Addresses
DEBUG SMTP:   "srose@geometrixx.info" <srose@geometrixx.info>
DATA
354 Ok Send data ending with <CRLF>.<CRLF>
Date: Sun, 2 Oct 2016 08:38:29 -0500 (CDT)
From: Geometrixx Gov <admin@geometrixx-gov.com>
To: "srose@geometrixx.info" <srose@geometrixx.info>
Message-ID: <2009663326.1.1475415511182.JavaMail.wolff@wolff-OSX>
Subject: Reminder: Continue your application for Child Support Services
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

...

6 Replies

Avatar

Level 9

Hi,

A few follow-up questions:

  • How do you initiate email batch process? Do you have any sort of custom scheduler for sending emails?
  • Was your SMTP mail server up when you initiated sending emails?

Regards,

Jitendra

Avatar

Level 2

Hi Jitendra,

The emails are generated from within the Geometrixx.gov reference site https://helpx.adobe.com/aem-forms/6-2/geometrixx-gov-reference-site-walkthrough.html (after selecting option to save progress and receive an email with link to unfinished application).  And, yes, the SMTP mail server (Apache James on localhost) is running. Here is an excerpt from the smtpserver.log showing that the messages were spooled all at the same time (at 2:48 AM, roughly 8 hours after sending from within reference site):

01/10/16 00:46:38 INFO  smtpserver: Connection from localhost (127.0.0.1)
01/10/16 01:47:44 INFO  smtpserver: Connection from localhost (127.0.0.1)
01/10/16 02:48:35 INFO  smtpserver: Connection from localhost (127.0.0.1)
01/10/16 02:48:35 INFO  smtpserver: Successfully spooled mail Mail1475308115702-3 from admin@geometrixx-gov.com on 127.0.0.1 for [srose@geometrixx.info]
01/10/16 02:48:35 INFO  smtpserver: Connection from localhost (127.0.0.1)
01/10/16 02:48:36 INFO  smtpserver: Successfully spooled mail Mail1475308115956-4 from admin@geometrixx-gov.com on 127.0.0.1 for [srose@geometrixx.info]
01/10/16 02:48:36 INFO  smtpserver: Connection from localhost (127.0.0.1)
01/10/16 02:48:36 INFO  smtpserver: Successfully spooled mail Mail1475308116222-5 from admin@geometrixx-gov.com on 127.0.0.1 for [srose@geometrixx.info]
01/10/16 02:48:36 INFO  smtpserver: Connection from localhost (127.0.0.1)
01/10/16 02:48:36 INFO  smtpserver: Successfully spooled mail Mail1475308116454-6 from admin@geometrixx-gov.com on 127.0.0.1 for [srose@geometrixx.info]
01/10/16 02:48:36 INFO  smtpserver: Connection from localhost (127.0.0.1)
01/10/16 02:48:36 INFO  smtpserver: Successfully spooled mail Mail1475308116688-7 from admin@geometrixx-gov.com on 127.0.0.1 for [srose@geometrixx.info]
01/10/16 02:48:36 INFO  smtpserver: Connection from localhost (127.0.0.1)
01/10/16 02:48:37 INFO  smtpserver: Successfully spooled mail Mail1475308116902-8 from admin@geometrixx-gov.com on 127.0.0.1 for [srose@geometrixx.info]

Avatar

Level 10

If you are not happy with ootb mail service - write your own AEM service using Java Mail API to send email messages from AEM - this will meet your requirement to send right away: 

https://helpx.adobe.com/experience-manager/using/creating-custom-cq-email-services.html

The benefit of a custom service is you can make it work to meet your business requirements. 

Avatar

Level 2

Thanks for the suggestion.  Would like to know if there's a configuration setting that controls this behavior, which would be much faster than creating a new service.

Avatar

Level 10

There is not too much docs on that - i see this Stackoverflow thread:

http://stackoverflow.com/questions/33077097/day-cq-mail-service-configuration-not-working

But no infor on batch vs separate email. Most ppl write their own service to send email on demand as discussed in this article that shows use of Java Mail API. 

Avatar

Level 2

Here is answer if anyone else installs the Geometrixx Gov reference site and wonders why email isn't immediately sent when saving a draft of the form.  The reference site includes a service (Geometrixx Finance Configuration) that contains a cron expression that configures when deamon runs that sends queued up emails to mail server.  The value is set to run daily at 2:00 a.m.  It is not a problem iwith the Day CQ Mail Service or Apache James.