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.
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
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.
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.
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.
I also checked the Mail Sending Status in the Administration-Application. The last log entry was made before I changed the Preferences-Page.
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}")
#end
#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)
{{html}}
<div class="xwikirenderingerror" title="Click to get more details about the error" style="cursor: pointer;">
$services.localization.render('xe.admin.passwordReset.error.emailFailed')
</div>
<div class="xwikirenderingerrordescription hidden">
<pre>${text}</pre>
</div>
{{/html}}
#end
## Check for an error constructing the message!
#if ($services.mail.sender.lastError)
#displayError($exceptiontool.getStackTrace($services.mail.sender.lastError))
#else
## 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)
#displayError($exceptiontool.getStackTrace($services.mail.sender.lastError))
#else
#set ($failedMailStatuses = $mailResult.statusResult.getAllErrors())
#if ($failedMailStatuses.hasNext())
#set ($mailStatus = $failedMailStatuses.next())
#displayError($mailStatus.errorDescription)
#else
{{success}}
It works!
{{/success}}
[...]
#end
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?
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:
{{velocity}}
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
{{/velocity}}
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:
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.
Now the remaining question is why the (installed) $services.mailsender fails to do its job properly.