Team Elements

Status: Caution PostgreSQL Open Source Initiative (OSI) Java
PUBLIC PROFILE

Back to topics

Feedback (Suggestions, comments, etc.)

SMTPMessage design issue?

You need to be logged in to post messages

SMTPMessage design issue?

7/3/2007 8:09 PM EDT

Hi. I've beeen dealing with Team Elements for a while and I have the following (already solved) problem. My mail server requires authentification to send emails. I just added a piece of code so Team Elements can handle this, but I realized there's something that's not clear for me.

I had to edit a lot of classes (every file calling the SMTPMessage.send() method) to add the mail authentification feature. Since the application is not supposed to change these parameters unless the war file is re-deployed, wouldn't it be better to initialize only once the SMTPMessage class, with all the parameters instead of calling the same methods every time? Is there any reason to have it designed the way it is?

1. 7/5/2007 12:31 AM EDT
Default user photo

By Matt Rajkowski

Concursive Corporation
Product Design

airplane-icon-100x100.png

The SMTPMessage Class belongs to a different package than Centric Team Elements... So that the SMTPMessage Class can be used outside of Centric Team Elements, in a script or other project, it currently doesn't have access to the ApplicationPrefs object.

I can see though that the HOST and AUTHENTICATION preferences would always be the same before using send() and it would be nice to populate these values every time.

My suggestion would be to construct the SMTPMessage using a SMTPMessageFactory Class or similar and replace the ~15 instances in the code.

import com.zeroio.utils.SMTPMessageFactory;

SMTPMessage mail = SMTPMessageFactory.createSMTPMessageInstance(prefs);

The method would call setHost and setAuthentication. If you would like that added to the source or have another suggestion please show us and let us know.

2. 7/5/2007 1:09 PM EDT

Matt Rajkowski wrote:
[...]
My suggestion would be to construct the SMTPMessage using a SMTPMessageFactory Class or similar and replace the ~15 instances in the code.

import com.zeroio.utils.SMTPMessageFactory;

SMTPMessage mail = SMTPMessageFactory.createSMTPMessageInstance(prefs);

The method would call setHost and setAuthentication. If you would like that added to the source or have another suggestion please show us and let us know.



It would be a great idea to add authentication. I can copy and paste some if my code if you need it as reference.

2 results found