M. M. Islam Chisty<br />Sr. J2EE Engineer<br />M&H Informatics<br />Ph. 8802-7121293<br />Dhaka, Bangladesh
Originally posted by Ernest Friedman-Hill:
Please don't post the same question to multiple forums. I deleted the other copy of the message in "Advanced Java".
Glancing at the program, I see where it receives messages, and then it just ignores what it received. So you want to store them, somehow. "How" depends on what you mean by "the user's mailbox." Would the user get their mail in an mbox formt file (as on many UNIX systems)? Or via POP or IMAP? There's no single standard.
If it's the first, then you just need to Google for "mbox format", learn the file format, and save the messages in the appropriate directory on your system (often /var/spool/mail) under the user's email ID. If it's another UNIX format, then you just have to learn about that other format.
If it's POP or IMAP, then you need to other find or write a server for the appropriate protocol, and have your SMTP server save the data in whatever format that server wants. There are many different possibilities, including simply using a database or other internal format peculiar to your pair of homemade servers.
M. M. Islam Chisty<br />Sr. J2EE Engineer<br />M&H Informatics<br />Ph. 8802-7121293<br />Dhaka, Bangladesh
Originally posted by M M Islam Chisty:
But it actually does not deliver the mail to the user menioned in the "TO" field. It is not the mbox format issue... maybe, some DNS related issue needs to be considered.
Originally posted by Ernest Friedman-Hill:
All I see here is code that reads commands from an SMTP client, and sends back "OK" regardless of what it receives. (The server actually doesn't read any message text associated with the DATA command, by the way; it just ignores those in the same way it would ignore invalid commands. These aren't actually valid SMTP responses: there's supposed to be a success or failure response code, and you're not displaying those. For example, here's what a correct MAIL FROM looks like, and a valid server response:
MAIL FROM: ejfried@javaranch.com
250 2.1.0 ejfried@javaranch.com... Sender ok
In any case, this server doesn't do anything except respond "OK" to the client. It just ignores and discards everything it reads. Are you saying you actually believe it should be delivering messages somehow, as is? This has nothing to do with DNS, nor indeed, at this level, with mbox format or any other format. This server just doesn't do anything!
If you want the server to deliver the messages it receives, then it will need to read all the data from the DATA command, save this data and the "from" and "to" information, and then do something with all this information. I suggested saving it to mbox or some other format; another option is to forward it to another SMTP server (i.e., turn around and become a client to the appropriate remote server.) Finding the appropriate remote server is a project in itself.
M. M. Islam Chisty<br />Sr. J2EE Engineer<br />M&H Informatics<br />Ph. 8802-7121293<br />Dhaka, Bangladesh
Right! We're on it! Let's get to work tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|