Fun with OpenOffice.org email merge!
So for a long time I've been trying to get this to work – apparently it worked in very early versions of OpenOffice.org, but then was later dropped. However, there was talk and talk and talk of it being finally included in OpenOffice.org version 2 – and all the early beta versions of 2.0 (1.9.xxxx, etc) all looked like they included the option. So every month or two I would grab the latest release and try it out -
The message that it gives you is that it cannot find JavaMail, which it claims it needs to do the email merge. However, no matter which way I tried to install Java and JavaMail (including going to “Tools – Options” in OpenOffice.org and adding javamail and its required jaf to the classpath), OOo would not recognize it and install it.
So after much digging and frustration I came across the sinister truth -
According to Oliver.Specht@sun.com,
“the message to install Java Mail doesn't tell the complete truth. To
access the Java Mail API from the mail merge wizard requires an
additional service ( com.sun.star.mail.MailServiceProvider ) that is not
availabe for OOo, and an additional configuration entry.
Sorry, I cannot answer the question how to get it.”
So for some reason that text was still left in there from StarOffice (I'm assuming), even though actual code to implement it was taken out of OpenOffice.org. Which is so annoying and misleading. I'm sure I'm not the only one to spend hours attempting to install JavaMail in frustration. And there seems to be no official posting or FAQ that lets us know this. Which is why I'm putting together this document.
So no matter how you install JavaMail, (which also, by the way, requires you to install the javabeans activation framework from Sun), the email merge will not work.
Good news, however, I finally figured out how to get it to work!
Apparently there's a patch to the source code to implement this,
but I myself am not sure how to use this – I'm not up to compiling the code myself, especially if I need to patch something in first. And it's unclear when it's going to make it into a release. Hopefully soon.
But until then, I found that the same python code that works that patch can be installed in a different way -
Here's how I got it to work -
This guy Caolan wrote this python code and posted it on his blog -
here is the python file:
Thank you very much Caolan!!
I've put it locally here just in case: mailmerge.py
But he doesn't make it too clear how to go about using it. The instructions are actually in the comments at the top of the python file.
I'm using OOo 2.0 on Windows XP, his instructions are for linux.
You should probably be out of OpenOffice (close the program) when you do all of this.
copy mailmerge.py into the /program/ subfolder of the openOffice.org program folder
(In windows, this is most likely at C:\Program Files\OpenOffice.org 2.0\program\, in linux I guess it's /usr/lib/openoffice.org2.0/program/ or something close)
in the /program/ folder there is also an executable called “unopkg”. Go to a command line if not already, switch to the OpenOffice.org 2.0/program/ folder, and type:
“unopkg add –-shared mailmerge.py” (in linux you would have to type ./unopkg instead of just unopkg, i think)
(note for command-line dummies: you have to press “enter” after the command to make it work)
Then you need to change one value in the Writer.xcu file, which is located in your home directory.
In my windows XP installation, I found it at
C:\Documents and Settings\My Username\Application Data\OpenOffice.org2\
Substitute “My Username” for the username of the account you're using.
In Linux, apparently it's at
where the tilde (~) represents your home directory (typically /home/your username/).
Depending on how you go about getting to the file, you may need to turn on viewing of hidden folders.
Open the Writer.xcu file in a text editor (ie, Notepad) and then find (Ctrl-F) the part of the file that says this:
<prop oor:name="EMailSupported" oor:type="xs:boolean">
and change the “false” value to “true”.
Then get back into openOffice. That's what I did and now the email merge works for me. It even did my SMTP server authentication.
I found the mail merge interface to be a bit clunky on both versions of openOffice, but finally I figured it out with the help of the help file. Once you get the trick of mail merging down, the email merge is easy to figure.
I can't stand the prepackaged “address block” and “salutation” things because they never match my fieldnames – and the dang wizard doesn't tell you how to put in your own fields outside of the salutation and address block –
so on step 6, the “Edit Document” step, I hit “Edit Document”, then F4 to pull up the data explorer, pull up my data source table in the data explorer, and put in the fields by dragging the field headers down. You can also hit Ctrl-F2, which is the “Insert Fields” shortcut, then go to the “Data” tab, then go to “Mail Merge Fields” and drag them from there. It works well, but is counterintuitive and not obvious at all to me, who am used to mail merges in Adobe Pagemaker, Avery Designer, and MS Word.
Also I found it very confusing that you can't do a label merge by starting from the “Mail Merge Wizard” - I find where I work, we do merges to labels much more often than we do merges to letters. Being used to Micro$quish Word, I was not at all inclined to start looking under “File – New – Labels” - which is what you have to do. In MS, you go to Mail Merge Wizard under Tools, and the option for Labels is there – one place to go for all mail merges.
Ah well. At least it works, it is much improved over OOo 1.x series, and it covers it in the help file.
Enough ranting. I hope this clears things up and works for others, as it did for me. I think it will.
Happy email merging!!!
feedback on this doc? I'd love to hear it – OOo_email_merge.email@example.com