Download it now!
Bug 117221 - MailMerge: Not recognising outgoing SMTP Server password when supplied by macro
Summary: MailMerge: Not recognising outgoing SMTP Server password when supplied by macro
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Alex Kempshall
URL:
Whiteboard: target:6.1.0
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-25 07:57 UTC by Alex Kempshall
Modified: 2018-06-06 16:30 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Kempshall 2018-04-25 07:57:02 UTC
Because the password is stored in registrymodifications.xcu in clear text. See Bug 96672 - Outgoing mail server password in clear text inside the registrymodifications.xcu file


I elected to supply the Outgoing mail server password using a text box and supplying the password to MailMerge using this property OutServerPassword within a macro as in the following code snippet.

    oMailMerge = CreateUnoService("com.sun.star.text.MailMerge")
    oMailMerge.DocumentURL =  ConvertToUrl(strSelectedTemplate)
    oMailMerge.DataSourceName =  "MySQLDataBase"
    oMailMerge.CommandType = 0        'Command

    oMailMerge.Command = "MySQLDataBase.tbl_temporary"
    oMailMerge.OutputType = com.sun.star.text.MailMergeType.MAIL
    oMailMerge.Subject = strTitle
    oMailMerge.AddressFromColumn = "Email_Address"
    oMailMerge.OutServerPassword="XXXXXXX YYYYYYY"

    oMailMerge.SendAsHTML = True

    oMailMerge.execute(Array())


It didn't work! Returned this information in an Error Message Box -


    BASIC runtime error.
    An exception occurred
    Type: com.sun.star.uno.Exception
    Message: Mail merge failed. Sorry, no further information available..
Comment 1 Alex Kempshall 2018-04-25 08:07:39 UTC
I believe the problem is in sw/source/uibase/uno/unomailmerge.cxx arounf about line 1009

Code snippet below. The last line is wrong.

            else if (pData == &m_aBlindCopiesTo)
                bOK = rValue >>= m_aBlindCopiesTo;
            else if(pData == &m_sInServerPassword)
                bOK = rValue >>= m_sInServerPassword;
            else if(pData == &m_sOutServerPassword)
                bOK = rValue >>= m_sInServerPassword;



Changed it as below and my macro now works.


diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx
index b5b477f56587..2816b6a0aa70 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -1006,7 +1006,7 @@ void SAL_CALL SwXMailMerge::setPropertyValue(
             else if(pData == &m_sInServerPassword)
                 bOK = rValue >>= m_sInServerPassword;
             else if(pData == &m_sOutServerPassword)
-                bOK = rValue >>= m_sInServerPassword;
+                bOK = rValue >>= m_sOutServerPassword;
             else {
                 OSL_FAIL("invalid pointer" );
             }
Comment 2 Alex Kempshall 2018-04-25 08:37:20 UTC
Submitted via logerrit a change to master
Comment 3 Xisco Faulí 2018-04-25 09:47:08 UTC
Thanks for the patch. Moving to Assing...

Gerrit patch: https://gerrit.libreoffice.org/#/c/53438/
Indeed, it looks like a typo in the code...
Comment 4 Xisco Faulí 2018-04-25 10:04:01 UTC
It seems it has been like this since the code was introduced -> https://cgit.freedesktop.org/libreoffice/core/commit/?id=1cc217311e945868269ad7a193fa83b6b79fbc1e
Comment 5 Commit Notification 2018-04-26 09:33:13 UTC
Alex McMurchy1917 committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=b114d094b6163ade1fe213653bf12412daf6c9c1

tdf#117221 - MailMerge: Not recognising outgoing SMTP Server password

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Xisco Faulí 2018-05-29 09:34:00 UTC
A polite ping to Alex McMurchy1917:
Is this bug fixed? if so, could you please close it as RESOLVED FIXED ?
Otherwise, Could you please explain what's missing?
Thanks
Comment 7 Alex Kempshall 2018-06-06 16:30:22 UTC
Tested successfully on 06Jun2018 with

Version: 6.1.0.0.beta1+

Built from

libreoffice-6-1~2018-06-06_00.30.37_LibreOfficeDev_6.1.0.0.beta1_Linux_x86-64_rpm.tar.gz