This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Murach's MySQL and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's MySQL this week in the JDBC and Relational Databases 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java mail error SendFailedException

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi gurus,
i am trying to test sun provided demo programs for testing JAVA Mail API
i am getting these errors please help me out ......

thanks in advance

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG: SMTPTransport trying to connect to host "my.test-inc.com", port 25
DEBUG SMTP RCVD: 220 X1 NT-ESMTP Server my.test-inc.com (IMail 6.05 30687-1)
DEBUG: SMTPTransport connected to host "my.test-inc.com", port: 25
DEBUG SMTP SENT: EHLO pankaj01
DEBUG SMTP RCVD: 250-my.test-inc.com says hello

DEBUG SMTP: use8bit false
DEBUG SMTP SENT: MAIL FROM:<pankaj@test-inc.com>
DEBUG SMTP RCVD: 250-SIZE 0

DEBUG SMTP SENT: RCPT TO:<pankaj@test-inc.com>
DEBUG SMTP RCVD: 250-8BITMIME

Verified Addresses
pankaj@dcr-inc.com
DEBUG SMTP SENT: DATA
DEBUG SMTP RCVD: 250-DSN

DEBUG SMTP SENT: QUIT
javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: 250-DSN

java.lang.Throwable(java.lang.String)
java.lang.Exception(java.lang.String)
javax.mail.MessagingException(java.lang.String, java.lang.Exception)
javax.mail.SendFailedException(java.lang.String, java.lang.Exception, javax.mail.Address [], javax.mail.Address [], javax.mail.Address [])
void javax.mail.Transport.send0(javax.mail.Message, javax.mail.Address [])
void javax.mail.Transport.send(javax.mail.Message)
void adt.com.ocs.ldap.ui.SendFile.main(java.lang.String [])


Re: no one has answer of my question?? please help!!
Author: dritesh Jul 22, 2001 1:41 PM


I need to know your script ie java files.

Re: no one has answer of my question?? please help!!
Author: pnk_jha Jul 23, 2001 6:02 AM


i will appriciate if any one tell me that, what am i doing wrong here....
here is the code......
===================
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
public class MailExample
{
public static void main (String args[]) throws Exception
{
String smtpHost = "my.test-inc.com";
//String smtpHost = "smtp.mail.yahoo.com";
String popHost = "my.test-inc.com";
//String popHost = "pop.mail.yahoo.com";
String from = "pankaj@my.test-inc.com";
String to = "pankaj@my.test-inc.com";
String username = "pankaj";
String password = "pjha";
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", smtpHost);
props.put("mail.smtp.auth", "true");
// Get session
Session session = Session.getInstance(props, new MyAthenticator());
session.setDebug(true);
// Pop Authenticate yourself
Store store = session.getStore("pop3");
store.connect(popHost, username, password);
// Define message
MimeMessage message = new MimeMessage(session);
InternetAddress addrTO=new InternetAddress(to);
InternetAddress addrFROM=new InternetAddress(from);
message.setFrom(addrTO);
System.out.println("from: "+addrFROM.getAddress());
System.out.println("to: "+addrTO.getAddress());
message.addRecipient(Message.RecipientType.TO,addrFROM);
message.setSubject("Hello JavaMail");
message.setText("Welcome to Yahoo's JavaMail");
Transport transport = session.getTransport("smtp");
transport.connect(smtpHost, username, password);
// Send message
transport.send(message);
}
}
class MyAthenticator extends Authenticator
{
public PasswordAuthentication getPasswordAuthentication()
{
return new PasswordAuthentication("pankaj","pjha");
}
}

================
here is the error which is coming.......

DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsy stems, Inc]
POP3: connecting to host "my.test-inc.com", port 110
S: +OK X1 NT-POP3 Server my.test-inc.com (IMail 6.05 53501-1)
C: USER pankaj
S: +OK welcome
C: PASS pjha
S: +OK maildrop locked and ready
from: pankaj@my.test-inc.com
to: pankaj@my.test-inc.com

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true

DEBUG: SMTPTransport trying to connect to host "my.test-inc.com", port 25

DEBUG SMTP RCVD: 220 X1 NT-ESMTP Server my.test-inc.com (IMail 6.05 40049-1)

DEBUG: SMTPTransport connected to host "my.test-inc.com", port: 25

DEBUG SMTP SENT: EHLO pankaj01
DEBUG SMTP RCVD: 250-my.test-inc.com says hello

DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: useEhlo true, useAuth true

DEBUG: SMTPTransport trying to connect to host "my.test-inc.com", port 25

DEBUG SMTP RCVD: 220 X1 NT-ESMTP Server my.test-inc.com (IMail 6.05 40050-2)

DEBUG: SMTPTransport connected to host "my.test-inc.com", port: 25

DEBUG SMTP SENT: EHLO pankaj01
DEBUG SMTP RCVD: 250-my.test-inc.com says hello
DEBUG SMTP: use8bit false
DEBUG SMTP SENT: MAIL FROM:<pankaj@my.test-inc.com>
DEBUG SMTP RCVD: 250-SIZE 0
DEBUG SMTP SENT: RCPT TO:<pankaj@my.test-inc.com>
DEBUG SMTP RCVD: 250-8BITMIME
Verified Addresses
pankaj@my.test-inc.com
DEBUG SMTP SENT: DATA
DEBUG SMTP RCVD: 250-DSN
DEBUG SMTP SENT: QUIT
javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: 250-DSN
at javax.mail.Transport.send0(Transport.java:219)
at javax.mail.Transport.send(Transport.java:81)
at MailExample.main(MailExample.java:45)
Exception in thread "main" Process Exit...


------------------
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello.
I don't use JavaMail, but I do know that you must send a "." on a line all by itself before sending out the "QUIT" command. It is surprising that you received the 250 reply. I would expect you to receive a reply code in the 500's if the sending failed.
Aaron
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi you write too much code. To send email only you need to type
Transport.send(message);
my example:
Properties props = new Properties();

Authenticator auth = new MyAuthenticator();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.host", host);
Session session = Session.getDefaultInstance(props, auth);
session.setDebug(true);
try {
// create a message
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);

msg.setSubject(temat);
// create and fill the first message part
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(cialo);

Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
//mp.addBodyPart(mbp2);
// add the Multipart to the message
msg.setContent(mp);
// set the Date: header
msg.setSentDate(new Date());

// send the message
Transport.send(msg);
 
Krzysztof Kwiatek
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
} catch (MessagingException mex) {
mex.printStackTrace();
Exception ex = null;
if ((ex = mex.getNextException()) != null) {
ex.printStackTrace();
}

} catch (Exception e) {
}
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic