Hello All, In my application, after generating user and password, i need to send the details thru e-mail to concerned person. So, i did this via socket programming and following SMTP protocol. After sending the header information, i receive from the SMTPserver a response code of 220 (indicating it is ready to receive data.) Then i send the message body, after which i get a response code of 250 (indicating success). But when i checked my mailbox i couldnot see the received mails. It is getting lost somewhere. Please help. I was sending the mails using webappcabaret SMTP and the receiving server was hotmail.com and yahoo.com. FYI.. i am giving the exact responses received: <b>response after header sent</b> : 220 db1 ESMTP Sendmail 8.9.3/8.9.3; Mon, 2 Oct 2000 21:24:57 -0700 <b>response from server after data is received:</b> 250 db1 Hello adsl-63-198-109-75.dsl.snfc21.pacbell.net [126.96.36.199], pleased to meet you Thanks sankar
While manually implementing the SMTP protocol is an interesting learning exercise, most people use one of the many available (free) mail classes which do it already. Sun's Java Mail API is the official way to do this, but there are plenty of alternatives. If you search for JavaMail here at the Saloon you will find lots of example code and installation instructions for Java Mail. [This message has been edited by Frank Carver (edited October 03, 2000).]
Thanks Frank. But i am interested in writing using sockets, as it will give me a better understanding of mail transfer protocols. Also i have seen code using sun.net.smtp.smtpclient. Is it part of standard JDK ? where can i find the documentation ? regards Sankar
Joined: Jan 07, 1999
sun.net.smtpclient is available but undocumented in most Sun JDKs. I would strongly caution against using it, though. Although it makes some simple cases simpler, it hasn't got the flexibility of JavaMail. Worst of all, it is not supported, and you can't guarantee that it will be present. If you get stuck with your implementation of the protocol, thge best place to look is in the public java source code repositories. There arev plenty of SMTP implementations available with source code for you to look at.