This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Iain Emsley

Ranch Hand
+ Follow
since Oct 11, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Iain Emsley

Thanks Paul. I've just realised that I'd misunderstood some of the spec but thanks picking up on the adding the element in the loop.
Hi,
I'm trying to use JDOM to convert some letters into XML. I can get the structure for the XML header, author tag and the whole letter into a tag, i.e
<author>hogarth<ln>text of the letter</ln></author> but what I want to do is to have each line attached to a node like <author>hogarth<ln>line 1</ln><ln>line 2</ln>...& so on</author>. However I keep getting the error message:
org.jdom.IllegalAddException: The Content already has an existing parent "author"
at org.jdom.ContentList.add(ContentList.java:209)
at org.jdom.ContentList.add(ContentList.java:131)
at java.util.AbstractList.add(Unknown Source)
at org.jdom.Element.addContent(Element.java:811)
at uk.co.austgate.xml.jdbcXml.toDocument(jdbcXml.java:38)

My code is:

The code is called from a Data Access Object to turn the letter text into XML to be serialised to a servlet. I'd be grateful for any suggestions or if i should be really be using something like SAX instead. Thanks in advance.
Iain
I'm trying to convert a file into base64 to be attached to a mail sent via JavaMail and I'm really trying to get the header set as using Content-Transfer-Encoding base64 as the file is an .ics file and sending it via 7bit leaves it up to the whims of the client to read it correctly (according to my reading of RFC 2045). I suppse I'm trying to do what Google does succesfully and set the following header:

but I'm getting:

The code that I've been using is:

I don't seem to be able to get the FileOutputStream to encode at all. I did try:

to get the string containing the data encoded but again, I've failed to be able to set the base64 header as the email turns up as Content-Transfer-Encoding: quotable-printed and the content-type stays as application/octet stream, despite trying to set the header in the DataSource line.
I'd be grateful for any pointers in solving this issue so that I can take luck out of our email equation.

Thanks.
9 years ago
I'm working on a calendaring system using ical4j to create the ical addresses but I'm trying to write the stream to a file to attach them via the attachFile() method. I've got the files being created correctly but cannot get the FileOutputStream to write the data into the file itself:

If I use tempCal.write(cal); I get an error as the CalendarOutputter doesn't support the write method. Many thanks in advance for any pointers.
9 years ago
No idea how you'd capture those headers, TBH. I've been looking at invitations from Google as they appear to have cracked the problem. You could also download the .ics file from the Outlook calendar and compare it to yours and see if there are any differences.
9 years ago
Outlook 2003 apparently has basic functionality and 2007 has better acceptance of the iCal standard but it is still dodgy (which is where I'm having an issue). The real trick is forcing the headers, as you surmise, but I still haven't had managed to fully figure this out. ical4j deals with most of the issues that you'll come across. (Or at least it has for me).
9 years ago
I have a similar problem, although only Outlook isn't seeing the headers all the time (posted in another thread here). Are you using ical4j to make the event as I've found that using that pretty much everything except Outlook will see the calendar event. Outlook appears to be the great bug bear in the arena.
9 years ago
I'm trying to send a calendaring email to a group of people via a threaded mailer and for some reason I can get the first email coming out with the relevant ics headers seen in MS Outlook 2007 but any subsequent emails are seen as plain text and the calendaring part of the mime message is ignored. Is there anything that I am missing or doing incorrectly? Thanks in advance for any pointers.

The mail Entity that is called by the programme:

and the callable() is section is:
9 years ago
Fixed it through rewriting the way the Mail was constructed and adding the .ics calendaring file to the
9 years ago
I'm working on a mailing system for a scheduling server and have managed to get it working with one quirk which I don't quite understand. The system comes out with an email containing calendaring data as content which only MS Outlook ignores (all other services and clients that we've tried accept the header) but I can't quite see why and would be grateful for any pointers as to what to investigate to solve this. From the headers I've seen, the text/calendar heading is accepted but the data is being ignored.

The headers are built here:
and then sent via a thread.
9 years ago
Nitesh, thanks, I'd missed out calling the newCachedThreadPool() although the threading has changed the programme's behaviour a little from sending an email to each address to lumping all the addresses together but I suspect a rewrite will sort that out.
I'm trying to implement a Mail Queue type affair in JavaMail using the ExecutorService to free up resources from the main app whilst the Mailer is cycling through the list of recipients as I'm working on a scheduling system which deals with groups of people by emailing each person separately.
So far I've got:

The error that I'm getting is that pool.execute(new sendMail(msg)); is empty but the msg is being created. Originally my class sendMail looked like:

which sent a mail with four names in the TO field (I'm trying to send one email to each recipient so that no group member can define the membership emails).

I don't doubt that there is something that I have not understood, but I'd appreciate some pointers as to how to achieve the Queuing effect.
As far as I'm aware there is no way of knowing unless you get a bounce message from a non-deliverable address. I don't think that JavaMail can check MX records but the SMTP server should be able to do that for you.
9 years ago
I'm working on a bulk mailer as part of scheduling system to handle any size of group and one of the bottle necks that we've found is fact the that each email needs to wait until the previous one is sent which in turn means the entire application freezes whilst mail is being sent (which given we have lists of over a thousand members means it could be a while) so I'm trying to implement some sort of basic threaded mail queue. I thought that I had the basics but nothing is being sent from the queue though the logging suggests that items are being added to the pool LinkedList entity

As it is my first shot at threading, I've probably misunderstood something or just plain missed it out but would appreciate pointers in the right direction.
9 years ago