Pozwole się podczepić pod tego posta z pytaniem: Jak wysłać wiadomość do wielu osób? Jak dałem to przez pętle for operującą na liście z adresami to już przy 2 adresie sie wysypuje z błędem:
550 Invalid recipient: [email protected]
Doszedłem do czegoś takiego że jak na stałe przypisze adresy tak
InternetAddress[] ao = {new InternetAddress("adrea1@cos"),new InternetAddress("[email protected]")};
message.addRecipients(Message.RecipientType.TO,ao);
to działa. Ale ja chce je pobierac z listy, ze wzgledu na to ze sie zmieniaja. I jak probuje zrobic tak
InternetAddress[] ao = new InternetAddress[2];
ao[0].setAddress("[email protected]"); <==tu sie wali
message.addRecipients(Message.RecipientType.TO,ao);
to mi nie działa. Wywala się na:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at FotoAlbum.WyslijEmail.wyslij(WyslijEmail.java:276)
at FotoAlbum.WyslijEmail$4.actionPerformed(WyslijEmail.java:438)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Może wiecie jak temu zaradzić???