• 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

javax.mail.SendFailedException:Sending Failed; when i send other domain

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I'm using java api mail. i tested gmail. its woring fine. and also am testing other domain server(testserver.com). its working under same domain(testserver.com to testserver.com).but when i try to send from testserver.com domain server to other domain like gmail or hotmail or yahoo means it showing exection.

here is my code:

try
{
Properties props = System.getProperties();
props.put("mail.smtp.host", "server2.testserver.com");
props.put("mail.debug", "true");
props.put("mail.smtp.user", "test@testserver.com");
props.put("mail.smtp.password", "test");
props.put("mail.smtp.port", "25");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.ssl", "true");
props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");


if (from != null && pword != null)
{
props.put("mail.smtp.auth", "true");
session = Session.getInstance(props,
new MyPasswordAuthenticator(from, pword));
}
else
{
session = Session.getDefaultInstance(props, null);
}
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));

InternetAddress toAddress[] = new InternetAddress[to.length];
for(int i = 0; i < to.length; i++)
{
toAddress[i] = new InternetAddress(to[i]);
}

message.setRecipients(javax.mail.Message.RecipientType.TO, toAddress);
message.setSubject(subject);
BodyPart bp1 = new MimeBodyPart();
Multipart multipart = new MimeMultipart();
bp1.setText(messageBody);
multipart.addBodyPart(bp1);
bp1 = new MimeBodyPart();
javax.activation.DataSource source = new FileDataSource(ff);
bp1.setDataHandler(new DataHandler(source));
bp1.setFileName("fileName");
multipart.addBodyPart(bp1);
message.setContent(multipart);
Transport.send(message);
System.out.println("Sucessfully sent");
}
catch(Exception e)
{
System.out.println((new StringBuilder("this is the error: ")).append(e).toString());
return false;
}


//***************


when i try to send gmail or anyother mail server means it showing below exception:

javax.mail.SendFailedException:Sending Failed;
nested exception is:
class javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?

Any one please find the solution.

Thanks in advance,

Vinoth sathiya
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does that other mail server support SSL connections?
 
vinoth sathiya
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for reply.

May i know how to identify if that(testserver.com) domain server is support SSL connection or not.?

Is there any program for that?

Thanks in advance.

Vinoth.Sathiya
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check the documentation of the host (if this is hosted somewhere) or ask the server admin.
 
vinoth sathiya
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:Check the documentation of the host (if this is hosted somewhere) or ask the server admin.



But they have configured in Outlook Express 2007 and make send and recieve other domain( gmail,yahoo,hotmail etc.,) also...

they said everything is configured correctly.

only problem when i use to send via smtp connection using our applications.


 
reply
    Bookmark Topic Watch Topic
  • New Topic