JavaMail Section Index | Page 5
How can I log the debug messages to a file when I session.setDebug(true)?
With the 1.3 release of JavaMail, there is support for session-level output streams. Call public void setDebugOut(java.io.PrintStream out) to change the stream from System.out. Passing in a value ...more
I'm getting my Session with Session.getDefaultInstance and its not getting changes to the Properties passed in. What's wrong?
In getDefaultInstance(Properties props), the Properties is only used in the initial call. Future calls ignore the setting, returning the previously created Session. If you need to change the Prope...more
I'm getting my Session with Session.getDefaultInstance and its not getting changes to the Properties passed in. What's wrong?
In getDefaultInstance(Properties props), the Properties are only used in the initial call. Future calls ignore the setting, returning the previously created Session. If you need to change the Prop...more
How can I tell the JavaMail API where to create a mail folder on my IMAP server?
The JavaMail API, for an IMAP server, sends the IMAP command, to create a new folder, to the IMAP server. JavaMail does not create anything; the IMAP server creates the folder, when requested to b...more
How do I deal with uuencoded attachments?
First, uuencode/uudecode is not reliable (several characters vary in different implementations, and it is easy to damage, or incorrectly calculate/incompletely insert, the encoding). That's why MI...more
How do I send email to a POP server?
You don't send email to a POP server. You send email to an address which is handled by an SMTP server. Then there may be a POP server which clients can use, to read the mail, after it is accepted ...more
When does folder.getMessages() get the messages?
The JavaDoc for folder.getMessages says:
....Folder implementations are expected to provide light-weight Message objects, which get filled on demand. .....
And in the JavaDoc for Message it say...more
How do I send multiple messages using the same SMTP connection? When I use Transport.send(message), this always opens a new connection.
The send method is static and doesn't care if you have connected or not. Use sendMessage.
How could I include electronic signature and encryption in a JavaMail message?
You can find an example of this at http://security.dstc.edu.au/projects/java/tutorials/messaging.html
How do you send an SMS message using the JavaMail API?
First of all, you need an SMS gateway for sending SMS messages (unless you plan to code one yourself...)
Take a look at, for example, www.kannel.org for an open source SMS gateway.
The way you a...more
Why do I keep getting a NULL when looking at the TO/FROM header fields?
Messages are not required to have anything in any of the headers. In particular, it is OK to have no valid "From:" header (and OK to have no valid "To:" header also). Only the SMTP envelope fields...more
Why do I get a NullPointer exception when I create an InternetAddress?
The InternetAddress(String) constructor method will throw a NullPointerException if the String reference passed to it is null. So, you might ask, why doesn't the documentation list that exception...more
If I am sending a signed mail to an end user, whose mailserver doesn't support S/MIME, what would happen to the message?
Servers traditionally aren't supposed to look inside the content of a message (well nowadays they do often filter for viruses).
The S/MIME stuff only is in the headers and body of the message, no...more
I want to use formating characters like tab ( ) in my mail messages but they are having no effect when the MIME type is text. How can I format my mail message?
Tab characters in a text document can be interpreted differently by the program rendering the document, with different "tab stop" settings rendering them by different numbers of actual "blank spac...more
How to move message from one folder to another?
Here is the code I am using to move the messages to another folder.
In findFolder method I search for the folder name and then open the folder to read-write. CurrentFolder is the folder from wher...more