Obtaining Mail Merge E-mail values

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
mcmurchy1917
Posts: 23
Joined: Fri Feb 22, 2013 2:15 pm

Obtaining Mail Merge E-mail values

Post 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
Slackware user
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Obtaining Mail Merge E-mail values

Post 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
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
mcmurchy1917
Posts: 23
Joined: Fri Feb 22, 2013 2:15 pm

Re: Obtaining Mail Merge E-mail values

Post 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
Slackware user
Post Reply