aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes Email's 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 "Email Watch "Email New topic
Author

Email's "To" Field.

Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
Hello All,

I have a question regarding sending mail and the "To" section of the outlook. I wrote a code of sending mail. And that same code is being used by 3 of 4 of my colleagues. So now when they run the code, the mail seems to come from me. The To section is being populated by my email address and everyone thinks that i had ran the code. Now the values are hard coded. But wanted to know is there any way of making it more flexible? Like the person sending the mail should have the email id populated in the To section of the mail. Don't want to do it via hard coding. Any suggestions on this would be appreciated. Thanks!
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
Oooooooohhhhhhh. The new page looks cool. But where is the edit button on posts??
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 875
    
    5
This is called configuration.

You don't hardwire the data into your program but obtain it from some external source.
For example the program could read in some configuration file with these data.
A popular format for this purpose is Java Properties file as either a flat or an xml one.

Almost any non-trivial program needs some configuration.

Of course the program could obtain the necessary value as a System property or (if applicable) a command-line argument.
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
I thought of properties file. But thought that lets say tomorrow a new person runs the code and he then has to add his email id. I want to make the code intelligent enough to know what exchange server email id is configured in outlook for the guy. Anyway to do it.
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 875
    
    5
You might also want to have a look at the Preferences API.
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
This is a complete new API for me. Any pointers on how to use this?
Ivan Jozsef Balazs
Rancher

Joined: May 22, 2012
Posts: 875
    
    5
search for Java preferences api
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Email's "To" Field.