hi everybody, i am chaitanya. i wrote a code which will connect to the yahoo smtp server and post a mail to the destination.
first i tried it using telnet from command prompt. i was a success. i thought to send an email through my java program. so i wrote this code.
each time we send a message to the server it replies with some numbers such as 220 250 334 as success proceed.
while sending the mail we have to get authenticated with the server. we have to send our mail id and password in base64 format. while i am sending my id to the server in base 64 format i am getting the reply as
----------451 Invalid Smtp line - Should end with CRLF
You will need to go through the entire SMTP protocol, and see how attachments should be added. I can tell you this: it involves creating a multipart email, and adding the attachment in decoded form (usually Base64) as part of the email body. I'm sorry to say I cannot help you on how to do that without using JavaMail.
Thank you sir, I too understood the problem in sending mail without using JavaMail API. Now I am using JavaMail API, instead of opening a socket via telnet.
But i have a problem there too. I am able to connect to yahoo smtp server. but when I am trying to connect to gmail smtp server and trying to authenticate the gmail server is sending an error report to me. It is asking me to issue a 'starttls' command.
After issuing starttls command the server is not responding.
I have read in a forum that telnet does not support starttls, for that i have to download an application called stunnel.
What I have observed is that JavaMail API is using telnet in background to send mails. As telnet is not supporting starttls, JavaMail API is not able to connect to gmail smpt server. Am I right sir? If not please tell me how to connect to gmail smtp server.
Joined: Mar 22, 2005
If not please tell me how to connect to gmail smtp server.