aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Content duplication with JavaMail API problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Content duplication with JavaMail API problem" Watch "Content duplication with JavaMail API problem" New topic
Author

Content duplication with JavaMail API problem

Leinad Nongag
Greenhorn

Joined: Aug 25, 2009
Posts: 17
Hello,

I'm working with an Email webservice using the JavaMail API.(2.4.1) .

My goal is to produce a RESTFul web service to send preformated Emails. So far, it's working fine and I know my web service is recieving the right data. But my problem is that 2 different mails using the same template with different content are sent with identical content, but different titles. If I'm doing my call from two different client, the result is as I expected to be. Which mean, two different mail using the same template . But if the same client is sending 2 mails with the same templats and different contents, it doesn't work. I recieve two mails with different title but the content is the same.

I'm trying to find a way to way to release the memory of the MimeMessage object. I really do not understand what the problem is. I'm running Java 7 on Windows XP.



What should I add to that class to delete this content after it beeing sent ?

Here the code inside the web service





Here an example of my problem. It's a very simplified example, in truth I'm using an HTML template which each field are fill when executing the doFusion. Même problem is that one of the properties is not showing the content it should.


The result of those two call looks like this :



If I do this :



The result of this call looks like this :






The result of this call looks like this :



I really don't understand because I log everything that the webservice is doing and all the data I send to the service is as it should be. But the results is not correct. It will cause me a huge problem because I need to send customized mails using the same template and the information must change between those mails.

Do you have any suggestions ?
Leinad Nongag
Greenhorn

Joined: Aug 25, 2009
Posts: 17
Hello,

I found my problem, it was a stupid mistake. I lost my template each time I was modifying, no at my second run, it was equal to the first template with the assigned fields. When it was time to assign all my parameters, they weren't anymopre inside the template, so the message looked like an exact copy from the previous mail.

Silly me !
 
jQuery in Action, 2nd edition
 
subject: Content duplication with JavaMail API problem
 
Similar Threads
Mail
sending mails through java
Having Problem in sending mail
Can't send a html based mail using java
Attachment in email not working in server