"Ramesh Babu A." wrote:
>
> Hi,
> I want to send e-mail from my java program.
>
> for that i opend socket on 25 (SMTP) port, and sent mail
> by executing HELP, MAIL FROM:, RCPT TO:, DATA.
> This is working fine only in the internal network. But if
> try send to hotamil/rocketmail they are not allowing to
> bind on that port.
[...]
[I don't think there's a Mail API in Java 1.1,
but there may well be one in 1.2, so this
applies if you can't wait for 1.2 to be
shipped for Linux.]
The best way is probably to allow an external
program to be configured which will actually
send the mail.
Have a configuration string, initially set to:
``/usr/lib/sendmail -t''. Allow people to
reconfigure this easily.
To send mail, start this program and pipe the
mail message to it, including To:, Cc:, From:,
Subject: and all other headers as required.
Make sure there's a blank line between headers
and message, and finish the message by writing
a single ``.'' on a line on its own. You may
need to escape ``.'' characters which appear
as legitimate parts of the message at the
beginning of a line.
For portability to Windows, you will unfortunately
have to write a little program which replaces
sendmail. It just needs to accept the message
and connect to a *user-configurable* machine
and SMTP port. (Note that most mail can be
relayed locally - it does not need to be sent
directly to the final mail server).
Rich.
--
- Richard Jones. Linux contractor London and SE areas. -
- Very boring homepage at: http://www.annexia.demon.co.uk/ -
- You are currently the 1,991,243,100th visitor to this signature. -
- Original message content Copyright (C) 1998 Richard Jones. -