Zdravicko,
mam mailoveho klienta, ktory sa pripoji k SMTP serveru a odosle email.
Vyuzivam pri tom javax.mail api.
Nas drobny problem je, ze ak sa chceme pripojit smtp serveru a poslat
email, nedosiahnutelny SMTP server vyexcepšnuje az pri sendMessage a nie
pri connect.
Podla specky sa to takto chova korektne (JavaMail-1.2.pdf):
// get a transport that can handle sending message to
// InternetAddresses. This will probably map to a transport
// that supports SMTP.
Transport trans = session.getTransport(addrs[0]);
// add ourselves as ConnectionEvent and TransportEvent listeners
trans.addConnectionListener(this);
trans.addTransportListener(this);
// connect method determines what host to use from the session
properties
trans.connect();
// send the message to the addresses we specified above
trans.sendMessage(msg, addrs);
Pre nas by bolo idealne zistit dostupnost SMTP serveru uz pri vytvarani
session objektu, ale nepali nas to zase az tak aby sme nasilu vytvarali
tcp/ip konekciu na port 25...
Ma niekto nejake elegantne riesenie na tento problem?
NORBERT KRANKILLA
J2EE Systems
IT Application & Integration Services
Information Technology
Komerční banka, a. s.
Na Příkopě 22
114 07 Praha 1
gsm: +420 725 530 345
e-mail: [EMAIL PROTECTED]
www.kb.cz
P Myslete na přírodu... Jezte bobry, zachráníte stromy.
Tento e-mail je urcen pouze pro jeho adresata/adresaty a muze obsahovat duverne
informace, jejichz ochrana muze byt vyzadovana pravnimi predpisy.
Jestlize jste zpravu obdrzel(a) omylem, neprodlene informujte jejiho
odesilatele a tuto zpravu, jeji prilohy a pripadne kopie ihned vymazte.
Jakakoli forma uziti, zverejneni, reprodukce, kopirovani, distribuce a sireni
teto zpravy je v takovem pripade zakazana.
Komercni banka, a.s., neodpovida za mozne skody zpusobene neuplnym prenosem,
moznou modifikaci ci zpozdenim teto zpravy behem prenosu od odesilatele k
adresatovi.
This e-mail transmission is intended solely for the ordinary user of the e-mail
address to which it was addressed. It may contain legally privileged and/or
confidential information.
If you have received this e-mail in error or are not an intended recipient
please inform the sender with-out delay and delete this e-mail, attachments and
possible copies immediately. The unauthorised use, disclosure, distribution
and/or copying of this e-mail or any information it contains is prohibited.
Komercni banka, a. s., does not accept liability for any damage caused by
incomplete transmission, possible modification or delay of this e-mail during
the transmission from the sender to the recipient.