I've got some code that uses MailMerge to email documents. It works.
However, the password is stored in registrymodifications.xcu in clear text.
Trying to move forward
I cleared the password from registrymodifications.xcu by
Tools -> Options -> LibreOffice Writer -> Mail Merge E-mail ->
Server Authentication
and deleting the contents of the password field.
The line in registrymodifications
changed from
<item oor:path="/org.openoffice.Office.Writer/MailMergeWizard"><prop
oor:name="MailPassword" oor:op="fuse"><value>XXXXXXX
YYYYYYY</value></prop></item>
to
<item oor:path="/org.openoffice.Office.Writer/MailMergeWizard"><prop
oor:name="MailPassword" oor:op="fuse"><value></value></prop></item>
I then changed my macro to include the MailMerge property
OutServerPassword. As in the code snippet below
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())
When I run the script it fails with the following error message box
BASIC runtime error.
An exception occurred
Type: com.sun.star.uno.Exception
Message: Mail merge failed. Sorry, no further information available..
What am I doing wrong?
Has anyone else got this working?
--
To unsubscribe e-mail to: users+unsubscribe@global.libreoffice.org
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
Context
- [libreoffice-users] LO:MailMerge supplying OutServerPassword via macro · Alex Kempshall
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.