Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-12078

send() Scripting API doesn't wait for the mail to be sent before returning

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.4-milestone-3
    • Fix Version/s: 7.1-milestone-2, 6.4.5
    • Component/s: Mail
    • Labels:
      None
    • Tests:
      Unit, Integration
    • Difficulty:
      Unknown
    • Similar issues:

      Description

      example:

      $services.mailsender.send($messages, 'database').getStatusResult().getSize()
      

      will return 0 even if a mail has been sent.

      The reason is:

      • send() will do a wait to verify if the mail has been sent before returning
      • However the implementation is bad since it checks if the mail is on the send mail queue and if it can't find it then it considers that the mail has been sent!
      • since the mail first gets prepared on the prepare queue before being put on the mail send queue, the send() will return immediately before the mail has been sent!

        Attachments

          Activity

            People

            Assignee:
            vmassol Vincent Massol
            Reporter:
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response: