Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

problem about java mail

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i like to use java mail in my application, and first time i try it through this code



which generates following output:


DEBUG: setDebug: JavaMail version 1.4.2
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "smtp.gmail.com", port 25, isSSL false
220 mx.google.com ESMTP 15sm538581fxm.14
DEBUG SMTP: connected to host "smtp.gmail.com", port: 25

EHLO Sabbir-PC
250-mx.google.com at your service, [117.18.231.27]
250-SIZE 35651584
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250 PIPELINING
DEBUG SMTP: Found extension "SIZE", arg "35651584"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<sadimohammads@gmail.com>
530 5.7.0 Must issue a STARTTLS command first. 15sm538581fxm.14
DEBUG SMTP: got response code 530, with response: 530 5.7.0 Must issue a STARTTLS command first. 15sm538581fxm.14

RSET
250 2.1.5 Flushed 15sm538581fxm.14
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. 15sm538581fxm.14

at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1668)
com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first. 15sm538581fxm.14

at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1207)
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:1668)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1207)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:735)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:735)
at javax.mail.Transport.send0(Transport.java:191)
at javax.mail.Transport.send0(Transport.java:191)
at javax.mail.Transport.send(Transport.java:120)
at javax.mail.Transport.send(Transport.java:120)
at MyMail.main(MyMail.java:33)
at MyMail.main(MyMail.java:33)
QUIT
221 2.0.0 closing connection 15sm538581fxm.14

and no mail sent to my id.......
please can someone help me??
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You got some of the details wrong, and the code is also missing authentication. See http://java.sun.com/products/javamail/FAQ.html#gmail
 
Warning! Way too comfortable! Do not sit! Try reading this tiny ad instead:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic