No daily E-Mail-Notifications received after updating the XWikiPreferences-Object

Thanks to the very well Attachment-Documentation we were able to increase the attachment size really easily. As mentioned here we changed the attachment size within the XWikiPreferences-Object.

Unfortunately, the notifications no longer work since the time of this change. No user of the wiki is receiving the Mail-Notifications anymore. I first assumed that when I saved this preferences page, something related to the email notifications was overwritten, but I haven’t found a suitable property, which confirms my theory.

I tested several things:

  • If I share Pages via E-Mail, it works absolutely fine. That means, that the Mail-Traffic is configured well.

  • The most common problem: Wrong Blog-Notification-Settings in the Administration. Even though all seems correct here, I turned the sliders off and on again, hoping that this would reset the values internally. Unfortunately, this did not lead to success.

  • I checked my notification settings. Seems all good here too.

  • We are now in the Scheduler-Application. I ran different jobs, for example Notifications daily email and Notifications weekly email. No notifications were received. I can imagine that the problem occurs because of something is wrong with the Scheduler or the Jobs.

Afterwards, I set some of the Loggers on TRACE:

  • com . xpn . xwiki . plugin . scheduler
  • com . xpn . xwiki . plugin . scheduler . internal
  • com . xpn . xwiki . plugin . scheduler . SchedulerPlugin
  • org . quartz . impl . StdSchedulerFactory
  • org . xwiki . mail
  • com . xpn . xwiki . plugin . mailsender

When I trigger the Job manually, no E-Mail action is taking place.

Catalina.out after triggering:

2020-06-10 22:28:31,319 [exampleDOTcom/xwiki/bin/view/Scheduler/?do=trigger&which=Scheduler.NotificationEmailWeeklySender] WARN o.x.v.i.DefaultVelocityEngine - Deprecated usage of getter [com.xpn.xwiki.api.Context.getLanguage] in 2518:/skins/flamingo/view.vm@9,43
2020-06-10 22:28:31,367 [DefaultQuartzScheduler_Worker-3] INFO c.x.x.p.s.i.StatusListener - Task [DEFAULT.xwiki:Scheduler.NotificationEmailWeeklySender_0] is about to be executed
2020-06-10 22:28:31,368 [exampleDOTcom/xwiki/bin/view/Scheduler/?do=trigger&which=Scheduler.NotificationEmailWeeklySender] INFO c.x.x.p.s.i.StatusListener - Task [DEFAULT.MT_1agse75iipb7e] scheduled
2020-06-10 22:28:31,368 [exampleDOTcom/xwiki/bin/view/Scheduler/?do=trigger&which=Scheduler.NotificationEmailWeeklySender] DEBUG c.x.x.p.s.SchedulerPluginApi - Trigger Job: [Notifications weekly email]
2020-06-10 22:28:31,493 [DefaultQuartzScheduler_Worker-3] INFO c.x.x.p.s.i.StatusListener - Task [DEFAULT.xwiki:Scheduler.NotificationEmailWeeklySender_0] executed:
2020-06-10 22:28:31,537 [exampleDOTcom/xwiki/bin/view/Scheduler/?do=trigger&which=Scheduler.NotificationEmailWeeklySender] WARN o.x.v.i.DefaultVelocityEngine - Deprecated usage of method [com.xpn.xwiki.web.XWikiMessageTool.get] in 2518:xwiki:Panels.QuickLinks@29,10
2020-06-10 22:28:32,001 [exampleDOTcom/xwiki/rest/notifications/count?media=json&userId=xwiki%3AXWiki.Admin&useUserPreferences=true&currentWiki=xwiki&async=true&_=1591820911901] TRACE i.DefaultNotificationsResource - Resource initialized. Serving user: ‘XWiki.Admin’

2020-06-10 22:28:32,001 [exampleDOTcom/xwiki/rest/notifications/count?media=json&userId=xwiki%3AXWiki.Admin&useUserPreferences=true&currentWiki=xwiki&async=true&=1591820911901] DEBUG .r.i.NotificationEventExecutor - Added [Notification event executor: 1256 : count : [4true/20xwiki:XWiki.Admin///////21//////5xwiki/true]] in the queue
2020-06-10 22:28:32,001 [Notification pool thread] DEBUG .r.i.NotificationEventExecutor - Starting execution [Notification event executor: 1256 : count : [4true/20xwiki:XWiki.Admin///////21//////5xwiki/true]]
2020-06-10 22:28:32,009 [Notification event executor: 1256 : count : [4true/20xwiki:XWiki.Admin///////21//////5xwiki/true]] DEBUG .r.i.NotificationEventExecutor - Finishing execution [Notification event executor: 1256 : count : [4true/20xwiki:XWiki.Admin///////21//////5xwiki/true]]
2020-06-10 22:28:32,010 [Notification event executor: 1256 : count : [4true/20xwiki:XWiki.Admin///////21//////5xwiki/true]] DEBUG .r.i.NotificationEventExecutor - Removed [Notification event executor: 1256 : count : [4true/20xwiki:XWiki.Admin///////21//////5xwiki/true]] from the queue
2020-06-10 22:28:33,097 [exampleDOTcom/xwiki/rest/notifications/count?media=json&userId=xwiki%3AXWiki.Admin&useUserPreferences=true&currentWiki=xwiki&async=true&asyncId=1256&
=1591820911902] TRACE i.DefaultNotificationsResource - Resource initialized. Serving user: ‘XWiki.Admin’

(I changed our real URL afterwards)

Do you have any idea what I could do to solve this problem? Maybe I missed something important?

Thanks in advance. Stay well!

Update: We also use an application which uses the Mailsender-API. If we send an E-Mail with this application, we get an 500 Internal Server Error. The mail is not sent.
Yesterday I restarted the XWiki. Then the Mailsender API was working and we received at least the Mails generated by this application.
Today again it does not work. I am really confused :open_mouth:

I tried to reproduce that issue in my Playground-XWiki by changing the XWiki-Preferences-Object there. But, of course, in my Playground-Wiki is everything working fine.

In both, my production Wiki and the playground, I use the version 10.11.8.

Hi, you should check the xwiki logs to see what the error is.

Hello Vincent,

thank you for your reply. Of course I checked the catalina.out, but there is nothing special to see. I set different loggers related to E-Mail-Sending to TRACE, especially the mailsender-API, but unfortunately the log does not indicate a problem.

I wonder why the normal page-sharing functunality is working. By the way, in this case the log is really informative and logs the corresponding entries.

It seems the Mail(sender)-API is not called or something like that.

Ok then maybe it means your test using the mailsender API is not fully correct and not handling error codes? (see

To test it you could copy paste the following in a wiki page:

Yes the mail sharing feature is still using the old, deprecated, mailsender plugin (see Loading...).

I could reproduce the issue on my playground increasing the attachment size within the XWikiPreferences and using my Application. A restore of an old version of the Preferences-Page does not fix the issue either.

That was also my thought, but the application uses code snippets from the “Forgot password?”-page, where all errors are catched correctly. To be on the safe side, a tested the whole “Reset Password”-Procedure. With the same result: I click on the ‘Reset password’-Button, the loading indicator of my Firefox is spinning continiously. It can take minutes, until the 500 Error Page of the Tomcat is shown.

I also tried different other suggestions for error-handling in this API-Documentation, but all what I have got is an empty page after saving the code and calling the page.

I did it, unfortunately I get neither an E-Mail nor any error. :confused:
I also checked the Mail Sending Status in the Administration-Application. The last log entry was made before I changed the Preferences-Page.

Maybe you could paste your code here. Now if you get a 500 error, you should really have a stack trace in the xwiki logs.

That’s normal since doesn’t use it. If you want to log the status in the DB you need to use #set ($mailResult = $services.mail.sender.send([$message], 'database')).

Now I am really confused. I noticed, that my application (and of course the ResetPasswort-App) uses the old Mail-API (services.mailsender).

In the case using the old API the loading indicator is spinning and I get a 500-Error. Yes, you are absolutely right, there should be logs, but there are not.

I replaced the API calls inside my app through the new calls (services.mail.sender). Now the error-check-branches are skipped and I get a success-message in my else-branch. But still no E-Mail.

Why I am so confused now? Because both APIs seems to be corrupted, but the Page-Sharing functionality works and my App and the daily notifications don’t.

The Code-Snippet (now with services.mail.sender):

Send the email

  #set ($from = $services.mail.sender.configuration.fromAddress)
  #if ("$!from" == '')
    #set ($from = "no-reply@${request.serverName}")
  #set ($mailTemplateReference = $services.model.createDocumentReference('', 'MyReferencingPage', 'MyMailTemplate'))
  #set ($mailParameters = {'from' : $from, 'to' : $userEmail, 'language' : $xcontext.locale, 'de': 'DE'})
  #set ($message = $services.mail.sender.createMessage('template', $mailTemplateReference, $mailParameters))
  ##set ($discard = $message.setType('Willkommen'))
  #macro (displayError $text)

      <div class="xwikirenderingerror" title="Click to get more details about the error" style="cursor: pointer;">
      <div class="xwikirenderingerrordescription hidden">

  ## Check for an error constructing the message!
  #if ($services.mail.sender.lastError)
    ## Send the message and wait for it to be sent or for any error to be raised.
    #set ($mailResult = $services.mail.sender.send([$message], 'database'))
    ## Check for errors during the send
    #if ($services.mail.sender.lastError)
      #set ($failedMailStatuses = $mailResult.statusResult.getAllErrors())
      #if ($failedMailStatuses.hasNext())
        #set ($mailStatus = $
        It works!

If I try to print the $mailResult out, I get only the variable name returned. But that could be a normal behaviour.

That does not look like normal behavior. Can you try to print out $services.mail.sender and see if you get something? I should be something like org.xwiki.mail.script.MailSenderScriptService and if it is not, then the mail sender API is not installed (maybe it did not initialize on startup).

Indeed, there is no URL-Response, I only get my velocity code.
I tested it with a different API, there everything is correct and the API is displayed in the same style you wrote. That means, there is really an issue with the Mailsender-api. In the Application Manager the Mail-API is listed. Is there another way to check or repair it?

What’s the result @basti?

When you said “I only get my velocity code.”, do you mean that you get $services.mail.sender printed?

You must put only that on a page (inside a velocity macro ofc):


Hello @vmassol,

good that you mention it, such mistakes can happen especially in the beginning. In fact, I did it right, even with other APIs. Here my code and the result:


Mail: $services.mail
Mail-Sender (new): $services.mail.sender
Mailsender (old): $services.mailsender

=== For test: ===
Model (expected: should working): $services.model
Other (expected: should not working): $services.foobar


The result on the page:

Mail: $services.mail
Mail-Sender (new): $services.mail.sender
Mailsender (old): org.xwiki.mail.script.MailSenderScriptService@d517c9b

For test:

Model (expected: should working): org.xwiki.model.script.ModelScriptService@3eebfed0
Other (expected: should not working): $services.foobar

As you can see, the new API does not work, on the other hand the old one should work.

If I change the API to the old one in my code, I will not get any mails either.

ok so this means that you have a problem with your XWiki instance. Normally it’s not possible since the mail sender api is bundled by default, unless you’ve removed it somehow.

Let’s see if you have it. You need to have the “Mail Sender Implementation” extension, as on:

Screenshot 2020-06-24 at 22.47.35

Yes, surprisingly this application is there.


Ok that’s weird :slight_smile:

With a user having programming rights, try the following:

$services.component.getInstance("org.xwiki.script.service.ScriptService", "mail.sender")

I guess it’ll not work either.

Your are so right! :smiley:

Correct, the second one does not work:

$services.component.getInstance(“org.xwiki.script.service.ScriptService”, “mail.sender”)

Just to be sure:

$services.component.getInstance("org.xwiki.script.service.ScriptService", "mail.sender")

Hello Vincent @vmassol,

again the same weird result.

$services.component.getInstance(“org.xwiki.script.service.ScriptService”, “mail.sender”)

@basti Have you tried restarting XWiki?

I just have checked with a fresh 10.11.8 instance, and this prints $services.mail all the time, because … this API new enough not to be available in that XWiki version. This explains one half of the issue. :slight_smile:

Now the remaining question is why the (installed) $services.mailsender fails to do its job properly.