<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>There's been a lot of changes in respect of MailMerge with
      LibreOffice 5.2 onwards and I've been caught out by some of these
      changes and raised bug reports for -</p>
    <p> <a class="bz_bug_link bz_status_RESOLVED bz_closed"
        title="RESOLVED NOTABUG - Mail Merge Wizard no longer works"
        href="https://bugs.documentfoundation.org/show_bug.cgi?id=102951">bug
        102951</a> for the MailMerge wizard which has been resolved as
      just a change of the MailMerge GUI being split;</p>
    <p><a class="bz_bug_link bz_status_NEW " title="NEW - MAILMERGE:
        Output Filename changed using CLI_UNO"
        href="https://bugs.documentfoundation.org/show_bug.cgi?id=102010">bug
        102010</a> which is still waiting for a fix</p>
    <p>Anyway, I've moved on and done some testing of the SendMail part
      of MailMerge and encountered what appears to be a race condition.
      In that if I generate a MailMerge for 2 recipients -</p>
    <ol>
      <li>the email for the second recipient appears to be never sent
        and definitely never ever received. <br>
      </li>
      <li>the success of the email for the first recipient is that it
        always looks like it's been sent but mostly it's never received.
        When it is received it is occasionally corrupted.</li>
    </ol>
    <p>However if I put in 2 sleeps in the file
      sw/source/ui/dbui/mmoutputtypepage.cxx as per this git diff,
      below, I consistently see the emails being sent and received
      successfully. This would appear to suggest that it's thread
      related though I have no knowledge of threads so I could be way of
      the mark here.<br>
    </p>
    <p>Unrelated, I've done some changes to the file mailmerge.py to
      enable me to send messages through the "mail.btinternet.com" smtp
      server so it would be good to discuss these changes with someone.
      Any suggestions as to who?</p>
    <p>For the suspected race condition should I raise a bug with my
      findings or wait to discuss with someone more knowledgeable? <br>
    </p>
    <p>Alex<br>
    </p>
    <p>
      <blockquote type="cite">index 5e42b2f..52db84c 100644<br>
        --- a/sw/source/ui/dbui/mmoutputtypepage.cxx<br>
        +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx<br>
        @@ -36,6 +36,13 @@<br>
         #include <maildispatcher.hxx><br>
         #include <imaildsplistener.hxx><br>
         <br>
        +#ifdef _WIN32<br>
        +#include <windows.h><br>
        +#else<br>
        +#include <unistd.h><br>
        +#include <time.h><br>
        +#endif<br>
        +<br>
         using namespace ::com::sun::star;<br>
         <br>
 SwMailMergeOutputTypePage::SwMailMergeOutputTypePage(SwMailMergeWizard*
        pParent)<br>
        @@ -313,6 +320,8 @@ void SwSendMailDialog::dispose()<br>
             {<br>
                 try<br>
                 {<br>
        +        sleep(1);<br>
        +<br>
                     if(m_pImpl->xMailDispatcher->isStarted())<br>
                         m_pImpl->xMailDispatcher->stop();<br>
                     if(m_pImpl->xConnectedMailService.is()
        && m_pImpl->xConnectedMailService->isConnected())<br>
        @@ -482,6 +491,7 @@ void  SwSendMailDialog::IterateMails()<br>
                 if(m_pConfigItem->IsMailReplyTo())<br>
                    
        pMessage->setReplyToAddress(m_pConfigItem->GetMailReplyTo());<br>
                 pMessage->addRecipient(
        pCurrentMailDescriptor->sEMail );<br>
        +    sleep(1);<br>
                 pMessage->SetSenderName(
        m_pConfigItem->GetMailDisplayName() );<br>
                 pMessage->SetSenderAddress(
        m_pConfigItem->GetMailAddress() );<br>
                
        if(!pCurrentMailDescriptor->sAttachmentURL.isEmpty())<br>
      </blockquote>
      <br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <p><br>
    </p>
  </body>
</html>