very strange javax,mail issue

H

hopehope_123

Hi All,

I have a very strange javax,mail issue. I wrote a java program which
sends very simple email to 3 different email user first yahoo,
second gmail and third is my business email. I use our corporate email
server for this purpose and relaying is enabled.

When i send 2 emails , they are sent successfuly but if i send 3 of
them together , last one is failed with address is not vali
exception. But address is valid, if i chaneg the orders always 3rd one
is failed. What can be the reason for this? Any setting in email
server?

thx
tol
 
D

Daniel Pitts

hopehope_123 said:
Hi All,

I have a very strange javax,mail issue. I wrote a java program which
sends very simple email to 3 different email user first yahoo,
second gmail and third is my business email. I use our corporate email
server for this purpose and relaying is enabled.

When i send 2 emails , they are sent successfuly but if i send 3 of
them together , last one is failed with address is not vali
exception. But address is valid, if i chaneg the orders always 3rd one
is failed. What can be the reason for this? Any setting in email
server?

thx
tol
It would help if you gave use a look at the code that causes this
problem. Preferably in SSCCE form.
<http://mindprod.com/jgloss/sscce.html>

It could be you have some bug in the code that specifies more than two
address, but that seems odd.
 
H

hopehope_123

Hi Daniel

this is the code:

public int sendAdminNotification(String pFrom,String pTo,String
smtpHost,String pData )
{
String subject="denemetest";
Session ses = null;
java.util.Properties
properties=System.getProperties();
properties.put("mail.smtp.host","nowhere");
properties.put("mail.smtp.connectiontimeout","60000");
properties.put("mail.smtp.timeout","60000");
ses = Session.getInstance(properties,null);
Transport trp =null;
try
{
trp = ses.getTransport("smtp");
}
catch (NoSuchProviderException ns)
{
System.out.println("error in
gettransportconnection:"+ns.getMessage());
}
catch (MessagingException mns)
{
System.out.println("error in
gettarnsportconnection:"+mns.getMessage());

}
trp = ConnectTransport(trp,smtpHost);

try {
MimeMessage message=new MimeMessage(ses);
Address fromAddress=new InternetAddress(pFrom);
message.setFrom(fromAddress);
Address[] toAddress=InternetAddress.parse(pTo);
message.setRecipients(Message.RecipientType.TO,toAddress);
message.setSubject(subject);
MimeMultipart mp = new MimeMultipart();
MimeBodyPart b1 = new MimeBodyPart();
b1.setContent(pData,"text/html");
b1.setDisposition(b1.INLINE);
mp.addBodyPart(b1);
message.setContent(mp);

System.out.println("sending ");
trp.sendMessage(message,message.getAllRecipients() );
System.out.println("sent ");
}
catch(AddressException ae)
{
System.out.println("h1:"+ae.getMessage());
return -1;
}
catch(SendFailedException se)
{
System.out.println("h2:"+se.getMessage());
return -2;
}
catch(MessagingException me)
{
System.out.println("h3:"+me.getMessage());
return -3;
}
ses=null;
trp=null;
return 1;
}


public static void main(String[] args)

{
mailServerData m = new mailServerData();
m.sendAdminNotification( "t@xxx","a@aaaa","smtpserver","test" );
m.sendAdminNotification( "t@xxx","b@bb","smtpserver","test" );
m.sendAdminNotification( "t@xxx","c@ccc","smtpserver","test" );
}

}
 
R

Roedy Green

When i send 2 emails , they are sent successfuly but if i send 3 of
them together , last one is failed with address is not vali
exception.

Perhaps your server has a limit of two emails per session. Turn on
debug and watch all the messages coming back from the server.

I have found such limits in various commercial email servers, but
usually bigger than 2.

In my bulk email program that number is one of the configuration
constants.

To experiment, do your three emails with 3 sessions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top