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: [email protected]
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