Using JavaMail API ina proxy server?

Discussion in 'Java' started by John Antypas, Aug 24, 2003.

  1. John Antypas

    John Antypas Guest

    OK, how's this one for interesting?

    I need a way to use JavaMail inside a Java-based SMTP proxy. In theory, the
    proxy would run, and, upon receiving a message, hand that off to filters
    which would use the JavaMail API for message handling. If the filter
    passes, then the Java API could do its real work and talk to the real MTA.

    1. Can I make JavaMail accept a stream from me to parse messages into
    objects?
    2. If not, could I createa session somehow that uses my proxy rather than a
    traditional store?

    --
    John Antypas
     
    John Antypas, Aug 24, 2003
    #1
    1. Advertising

  2. John Antypas

    GaryM Guest

    "John Antypas" <> wrote in
    news:1sa2b.18143$2.webusenet.com:

    <SNIP>


    > 1. Can I make JavaMail accept a stream from me to parse messages
    > into objects?


    Javamail requires an MTA to deliver mail and can handle a couple of
    transports for retrieving mail. To employ it in a streaming real time
    manner, IMO, was not the intention of the orginal designers.

    In reality such an application will need to be an SMTP Server that,
    as a final step, converts the received SMTP byte stream to a
    javax.mail.MimeMessage, so that you can use it's message querying /
    filtering to do what you want to do.

    Presumably then, you would use the same SMTP server to move it on to
    the mail store (Javamail can contact the Transport for you and pass
    it for delivery). Note your SMTP Server would also have to write code
    to write to the mail store.

    In short, Javamail helps you with the message object, the querying
    and the final delivery, all of which are not really your headache.
    It's all the SMTP conversation stuff and platform specific mail
    stores.

    I think Apache Foundation's "James" project may be of interest to you
    as it employs "mailets" to easily incorporate spam filters, and it
    already is an SMTP/POP3/IMAP4 (and even a USENET) server.

    > 2. If not, could I createa session somehow that uses my proxy
    > rather than a traditional store?
    >


    Various SMTP servers have a ways of taking raw rfc822 formatted
    messages for delivery. For example

    'sendmail -oi < mymessage.eml'

    will pass a raw message for delivery. You could use javamail to
    retrieve mail from, eg, a POP3 store and once it passes the filters,
    submit it to the SMTP server for final delivery. The issues are
    obviously, how often to you poll for messages and what happens if
    someone checks in between polls ... I'd feel more comfortable with
    the Apache James approach.

    HTH,

    Gary
     
    GaryM, Aug 26, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Greg
    Replies:
    4
    Views:
    317
    Steven Simpson
    Aug 16, 2012
  2. Knute Johnson
    Replies:
    0
    Views:
    211
    Knute Johnson
    Jul 29, 2012
  3. Knute Johnson
    Replies:
    0
    Views:
    177
    Knute Johnson
    Jul 29, 2012
  4. Knute Johnson
    Replies:
    0
    Views:
    148
    Knute Johnson
    Jul 30, 2012
  5. Steven Simpson
    Replies:
    0
    Views:
    161
    Steven Simpson
    Jul 30, 2012
Loading...

Share This Page