5

The convention with using JavaMail seems to be: -- Use smtp for sending emails -- Use imap (or pop) for reading emails ..

For our applications purposes, I reckon it is more useful to use an email client protocol (imap specifically) to send emails .. and ensure copies of all sent mail make into the 'Sent' folder of gmail or whatever mail account used.

Note, the primary point of the email connection is just to send mails, not to read or poll emails.

Would like opinions/suggestions/examples from others who have used imap for sending emails from their java apps. All posts appreciated.

1 Answer 1

11

Simple answer: It is not possible to send emails with IMAP. You have to use SMTP for sending emails.

More precisely there are some extensions to combine sending and retrieval operations. However, as far as I know, these extensions are not widely spread - neither on the client nor on the server side.

See also the article on wikipedia about IMAP (IMAP#Disadvantages):

Unlike some proprietary protocols which combine sending and retrieval operations, sending a message and saving a copy in a server-side folder with a base-level IMAP client requires transmitting the message content twice, once to SMTP for delivery and a second time to IMAP to store in a sent mail folder. This is remedied by a set of extensions ...

1
  • Thanks, nosid .. You have saved me plenty of poking about. Seems our only option would be to use smtp for sending emails but rely on CC'ing to a required account, with specific subject tags that could then be filtered within the account into a folder. Apr 10, 2012 at 11:29

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.