Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2007

Tip: Looking for answers? Try searching our database.

very strange javax,mail issue

Thread view: 
hopehope_123 - 27 Dec 2007 22:39 GMT
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
Daniel Pitts - 28 Dec 2007 00:19 GMT
> Hi All,
>
[quoted text clipped - 11 lines]
> 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.
Signature

Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>

hopehope_123 - 28 Dec 2007 07:07 GMT
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" );
}

}

On 28 Aralık, 02:19, Daniel Pitts
<newsgroup.spamfil...@virtualinfinity.net> wrote:
> > Hi All,
>
[quoted text clipped - 22 lines]
>
> - Alıntıyı göster -
Roedy Green - 28 Dec 2007 13:48 GMT
On Thu, 27 Dec 2007 14:39:31 -0800 (PST), hopehope_123
<hopehope_123@yahoo.com> wrote, quoted or indirectly quoted someone
who said :

>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.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.