Page 1 of 1

Obtaining Mail Merge E-mail values

Posted: Fri Apr 27, 2018 11:34 am
by mcmurchy1917
I know that if I open a document with writer and navigate

Tools -> Options -> LibreOffice Writer -> Mail Merge E-Mail

I can see the various settings to enable me to send emails. Such as E-Mail Address, Server Name, Port and SSL settings.

How can I find these values using a macro?

I'm using LibreOffice.

Alex

Re: Obtaining Mail Merge E-mail values

Posted: Fri Apr 27, 2018 5:28 pm
by Villeroy
You find them in file registrymodifications.xcu of your user profile folder and in plain text unfortunately.
viewtopic.php?f=20&t=29525&p=134621#p134621

Re: Obtaining Mail Merge E-mail values

Posted: Mon Apr 30, 2018 10:26 am
by mcmurchy1917
Thanks for the reply. Based on what you advised I developed this bit of code which worked successfully.

Code: Select all

Sub getMailMergeAddress() As String
		Const sNodePath$ = "/org.openoffice.Office.Writer/MailMergeWizard"
		oNode = getOOoSetupNode(sNodePath$)
		getMailMergeAddress = oNode.getByName("MailAddress")
'		print MailAddressval
End Sub

Function getOOoSetupNode(sNodePath$)
	Dim aConfigProvider, oNode, args(0) As new com.sun.star.beans.PropertyValue
   aConfigProvider = createUnoService("com.sun.star.configuration.ConfigurationProvider")
   args(0).Name = "nodepath"
   args(0).Value = sNodePath
   getOOoSetupNode = aConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", args())
End Function
I am aware that for LibreOffice the MailMerge password is held in clear text in ~/.config/libreoffice/4/user/registrymodifications.xcu

From what you say this may also be true for OpenOffice.

In my case I'm not storing the password in registrymodifications.xcu but asking the user to supply the password each time they click a button, on a form, to kick off the MailMerge process. I needed the MailAddress so that the user is made aware of what the outgoing email address is so that they can supply the appropriate password.

Thanks so much for your help