dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #04981
Re: Emails not being sent
I have debugged this particular piece of code before and made a peculiar
discovery: Even though exceptions from the apache commons email library are
being handled (logged, that is), other exceptions in the same method are
swallowed. This is due to the task executor being used (spring
SimpleAsyncTaskExecutor) to execute the emailing routine. Therefore, as Bob
points out, it is likely the problem is happening elsewhere (of the email
library) and exceptions might not be logged at all (due to the task
executor).
The following link should provide a pretty good starting point for
implementing a task executor which logs any exceptions.
http://java.dzone.com/articles/spring-async-and-exception
I have actually done this before but sadly did not save the code as it was
used only for debugging a single case. Unfortunately I am on holiday at the
moment so I cannot help you further with the code. The guide at the link
I've provided should cover most aspects and be easy to implement for anyone
familiar with the general codebase, though.
Worth a try I'd say.
Halvdan
2014-07-29 12:51 GMT+01:00 Bob Jolliffe <bobjolliffe@xxxxxxxxx>:
> Ah ok. So I think there is no need to waste time doing the tcpdump thing.
> If the log file is not saying that email has been sent then there will
> have been no comms with the mail server.
>
> So you are right - there seem not to be a problem with the lower level
> email sending code. The issue is elsewhere.
>
> Somebody a bit closer to the messaging code should be able to help you
> debugging why the messages are not being sent. I could work through the
> code but will take longer than someone more familiar with it. I might get
> the chance later in the week but definitely not today :-(
>
>
> On 29 July 2014 12:29, WILLIAMS, Ryan O'Neil <williamsryan@xxxxxxx> wrote:
>
>> Thanks Bob,
>>
>>
>>
>> There are two issues or “functions”.
>>
>>
>>
>> 1. Password recovery (uses email function)
>>
>> a. This now works since the installation of the lasted build of
>> 2.15
>>
>> 2. Messages sent via email (when use enables this)
>>
>> a. This does not work
>>
>> b. No entire are in the log files pertaining to this
>>
>> c. This is the reason for my questions, is there a scheduler (but
>> over 48hrs later, still nothing in log)
>>
>> Since item 1 works and not 2, leads me to believe that it is not only an
>> email issue.
>>
>>
>>
>> I will try to test for communications between the server and the email
>> server.
>>
>>
>>
>> Thanks
>>
>> ryan
>>
>>
>>
>> *From:* Bob Jolliffe [mailto:bobjolliffe@xxxxxxxxx]
>> *Sent:* mardi 29 juillet 2014 13:08
>>
>> *To:* WILLIAMS, Ryan O'Neil
>> *Cc:* dhis2-users@xxxxxxxxxxxxxxxxxxx
>> *Subject:* Re: [Dhis2-users] Emails not being sent
>>
>>
>>
>> Hi Ryan
>>
>>
>>
>> I hope one of the authors of that module who will have been working and
>> testing the module will be able to answer this more authoritatively. My
>> comments were based really on a reading of the source code and predicting
>> from that what it *should* be doing.
>>
>>
>>
>> What I can say is that there is no scheduler, or if there is it has
>> already been invoked for you to see the log messages that you do. The code
>> which sends the email seems to do it there and then and should be throwing
>> some exception if it fails ie. you shouldn't really see the "Email sent
>> using host" line in your log if the sending fails. Rather you should
>> see "Could not send email: "
>>
>>
>>
>> Of course it is hard to know what the mailhost does with it but it seems
>> what you are saying is that the mail doesn't reach it. As I indicated
>> earlier what I would do is to use something like tcpdump on the server to
>> verify whether there is comms with the mailserver or not.
>>
>>
>>
>> Regards
>>
>> Bob
>>
>>
>>
>> On 29 July 2014 10:49, WILLIAMS, Ryan O'Neil <williamsryan@xxxxxxx>
>> wrote:
>>
>> Hi Bob,
>>
>>
>>
>> I just installed 2.15 build 15196 and it managed to solve one aspect of
>> the problem. Email recovery now works.
>>
>> Two additional lines show up in the log after the “recovery message sent”
>> line
>>
>>
>>
>> * INFO 2014-07-28 18:33:08,739 Recovery message sent for user: xxx
>> (AccountController.java [TP-Processor8])
>>
>> * INFO 2014-07-28 18:33:08,851 Sending email to user: xxx with email
>> address: xxx@xxxxxxx (EmailMessageSender.java
>> [SimpleAsyncTaskExecutor-76])
>>
>> * INFO 2014-07-28 18:33:08,931 Email sent using host: aaaa.bbb.com with
>> TLS: false (EmailMessageSender.java [SimpleAsyncTaskExecutor-76])
>>
>>
>>
>> However, email messages are still not being send via the message module,
>> even though the recipients all have “Enable message email notifications”
>> checked.
>>
>> No lines concerning messages appear in the log. Should message be sent
>> immediately or is there a scheduler for this?
>>
>>
>>
>> Ryan
>>
>>
>>
>> *From:* Bob Jolliffe [mailto:bobjolliffe@xxxxxxxxx]
>>
>> *Sent:* vendredi 25 juillet 2014 13:29
>>
>> *To:* WILLIAMS, Ryan O'Neil
>> *Cc:* dhis2-users@xxxxxxxxxxxxxxxxxxx
>> *Subject:* Re: [Dhis2-users] Emails not being sent
>>
>>
>>
>> Yes you are right. I see lars added it on 20 May.
>>
>>
>>
>> Though I see that the change was backported to 2.15 in rev 15054. If you
>> upgrade your war to the latest build of 2.15 (available from
>> https://apps.dhis2.org/ci/job/dhis-2.15/lastSuccessfulBuild/artifact/dhis-2/dhis-web/dhis-web-portal/target/dhis.war)
>> you will find that the email from_address setting has been added. It might
>> be your other problem is addressed as well.
>>
>>
>>
>> Regards
>>
>> Bob
>>
>>
>>
>> On 25 July 2014 09:56, WILLIAMS, Ryan O'Neil <williamsryan@xxxxxxx>
>> wrote:
>>
>> I think that is as of 2.16. In 2.15 I don’t see it.
>>
>>
>>
>> *From:* Bob Jolliffe [mailto:bobjolliffe@xxxxxxxxx]
>> *Sent:* jeudi 24 juillet 2014 15:49
>>
>>
>> *To:* WILLIAMS, Ryan O'Neil
>> *Cc:* dhis2-users@xxxxxxxxxxxxxxxxxxx
>> *Subject:* Re: [Dhis2-users] Emails not being sent
>>
>>
>>
>> Sorry Ryan, just looking again at the code, I am not right about
>> FROM_ADDRESS being hard coded. This is in fact a system setting - in email
>> settings dialog.
>>
>>
>>
>> On 24 July 2014 14:04, WILLIAMS, Ryan O'Neil <williamsryan@xxxxxxx>
>> wrote:
>>
>> Hi Bob,
>>
>>
>>
>> Thanks for providing the FROM_ADDRESS.
>>
>>
>>
>> I will ask IT check the traffic information between the servers.
>>
>> I sent an email through the server from my computer via telnet using the
>> FROM_ADDRESS:noreply@xxxxxxxxx and it went through fine.
>>
>>
>>
>> ryan
>>
>>
>>
>> *From:* Bob Jolliffe [mailto:bobjolliffe@xxxxxxxxx]
>> *Sent:* jeudi 24 juillet 2014 12:44
>> *To:* WILLIAMS, Ryan O'Neil
>> *Cc:* dhis2-users@xxxxxxxxxxxxxxxxxxx
>> *Subject:* Re: [Dhis2-users] Emails not being sent
>>
>>
>>
>> Hi Ryan
>>
>>
>>
>> From what I understand of the source code, if the message sending failed
>> there should have been a warning entry in your log saying "Could not send
>> email: ... <reason>". If you are not seeing that then it is strange and
>> not consistent with the documentation of the apache commons email library
>> which is being used.
>>
>>
>>
>> Can you perchance verify with ethereal or tcpdump that there is no
>> traffic between dhis2 and the email server?
>>
>>
>>
>> The FROM_ADDRESS is currently hardwired to "noreply@xxxxxxxxx". Hope
>> its not being clobbered by a spam filter on your email server.
>>
>>
>>
>> Bob
>>
>>
>>
>> On 24 July 2014 10:49, WILLIAMS, Ryan O'Neil <williamsryan@xxxxxxx>
>> wrote:
>>
>> Dear all,
>>
>>
>>
>> We are running version 2.15 instance of dhis2 and we are having trouble
>> getting the email functionality to work.
>>
>>
>>
>> The email server address and port have been provided using the email
>> settings UI.
>>
>>
>>
>> We have tried to use the recover password and send message functionality
>> to no avail. Each time the functions are executed, the following entries
>> can be found in the catalina.out log file respectively:
>>
>>
>>
>> * … Recovery message sent for user: xxx
>>
>>
>>
>> OR
>>
>>
>>
>> * … Sending email to user: User{surname='xxx', …firstName= …
>> (EmailMessageSender.java [SimpleAsyncTaskExecutor-664])
>>
>> * …Email sent using host: emailserver with TLS: false
>> (EmailMessageSender.java [SimpleAsyncTaskExecutor-664])
>>
>>
>>
>> No entries can be found on the email server concerning these emails. No
>> errors concerning emails can be found in the catalina log file.
>>
>> Other applications on the same server using the same settings can
>> successfully send emails.
>>
>>
>>
>> Any ideas about what the problem could be or how we can debug this in
>> more detail?
>>
>> Also, I don’t see a way to configure the FROM_ADDRESS, is this possible?
>> What is the default sender?
>>
>>
>>
>> cheers
>>
>> *Ryan*
>>
>>
>>
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help : https://help.launchpad.net/ListHelp
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help : https://help.launchpad.net/ListHelp
>
>
References
-
Emails not being sent
From: WILLIAMS, Ryan O'Neil, 2014-07-24
-
Re: Emails not being sent
From: Bob Jolliffe, 2014-07-24
-
Re: Emails not being sent
From: WILLIAMS, Ryan O'Neil, 2014-07-24
-
Re: Emails not being sent
From: Bob Jolliffe, 2014-07-24
-
Re: Emails not being sent
From: WILLIAMS, Ryan O'Neil, 2014-07-25
-
Re: Emails not being sent
From: Bob Jolliffe, 2014-07-25
-
Re: Emails not being sent
From: WILLIAMS, Ryan O'Neil, 2014-07-29
-
Re: Emails not being sent
From: Bob Jolliffe, 2014-07-29
-
Re: Emails not being sent
From: WILLIAMS, Ryan O'Neil, 2014-07-29
-
Re: Emails not being sent
From: Bob Jolliffe, 2014-07-29