开发者

The quintessential email listener / mini server in Java or .NET

开发者 https://www.devze.com 2023-01-11 01:49 出处:网络
I\'m embarrased of how I\'m unaware of SMTP / POP3 / IMAP protocols, as much as I thought I know HTTP and TCP/IP it apears that I took email as granted, and never had to write any piece of code that w

I'm embarrased of how I'm unaware of SMTP / POP3 / IMAP protocols, as much as I thought I know HTTP and TCP/IP it apears that I took email as granted, and never had to write any piece of code that will do other than sending an email via an existing SMTP server.

My task is to write an incomming email channel and I would like to hear wha开发者_JAVA百科t is the basic aproach

What I need is the ability to listen to a specific email address, and capture the body, subject and attachment of that email for further processing.


I understand you want to programatically recieve mail...use subethasmtp (much lighter and easier than james etc, works very well.


If you want your server to receive e-mails, it's an SMTP server that you need.

(You'll also need to make sure that the e-mail address is set up to be sent to that server, via the MX entry in the DNS.)

Note that, depending on how you want to install this service, you might not need to write an SMTP server yourself (or even use a library). Existing SMTP servers are often capable of delegating the processing of an e-mail to external applications.

You could use somelike Postfix and configure it to use pipe for that address, to send the e-mail to process to the program of your choice (including one that you develop yourself). I'm fairly sure Exim, Sendmail and other MTAs have similar features. With this sort of configuration, your application would usually need to be able to read the e-mail from the standard input (and have the ability to split/process headers and body), but that's usually much simpler that writing an MTA/SMTP server.

If you really want tighter integration with the MTA, perhaps this could be a good starting point (I've never tried it): http://james.apache.org/


An SMTP server is usually how you'd refer to an outbound mail server; it sends mail.

POP and IMAP allow you to connect to a mail server, to read the mail that's already been received.

You need the receiving/server side of SMTP, and you might benefit from reading up on MTA; mail transfer agent.

You might also be interested in reading about SMTP proxies; so, sent mail would go through your server - and could be filtered/listened to, I suppose - and then get sent further to it's actual recipient.


Use the JavaMail API

0

精彩评论

暂无评论...
验证码 换一张
取 消