email - Javamail /hMailServer 550 Delivery is not allowed to this address -
i trying send emails javamail , local smtp serveur (hmailserver)
. tell me if javmail best way send email java?
then have error tells me => 550 delivery not allowed address dont understand if format of or adress self:
stacktrace:
severe: erreur dans le message severe: javax.mail.sendfailedexception: invalid addresses;<br>
nested exception is:
com.sun.mail.smtp.smtpaddressfailedexception: 550 delivery not allowed address. @ com.sun.mail.smtp.smtptransport.rcptto(smtptransport.java:1835) @ com.sun.mail.smtp.smtptransport.sendmessage(smtptransport.java:1098) @ javax.mail.transport.send0(transport.java:195) @ javax.mail.transport.send(transport.java:124) @ dao.sendemail.sendemail(sendemail.java:51) @ beans.actionbean.ajouter(actionbean.java:59) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:39) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:25) @ java.lang.reflect.method.invoke(method.java:597) @ com.sun.el.parser.astvalue.invoke(astvalue.java:254) @ com.sun.el.methodexpressionimpl.invoke(methodexpressionimpl.java:302) @ com.sun.faces.facelets.el.tagmethodexpression.invoke(tagmethodexpression.java:105) @ javax.faces.component.methodbindingmethodexpressionadapter.invoke(methodbindingmethodexpressionadapter.java:88) @ com.sun.faces.application.actionlistenerimpl.processaction(actionlistenerimpl.java:102) @ javax.faces.component.uicommand.broadcast(uicommand.java:315) @ javax.faces.component.uiviewroot.broadcastevents(uiviewroot.java:794) @ javax.faces.component.uiviewroot.processapplication(uiviewroot.java:1259) @ com.sun.faces.lifecycle.invokeapplicationphase.execute(invokeapplicationphase.java:81) @ com.sun.faces.lifecycle.phase.dophase(phase.java:101) @ com.sun.faces.lifecycle.lifecycleimpl.execute(lifecycleimpl.java:118) @ javax.faces.webapp.facesservlet.service(facesservlet.java:593) @ org.apache.catalina.core.standardwrapper.service(standardwrapper.java:1542) @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:281) @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:175) @ org.apache.catalina.core.standardpipeline.doinvoke(standardpipeline.java:655) @ org.apache.catalina.core.standardpipeline.invoke(standardpipeline.java:595) @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:161) @ org.apache.catalina.connector.coyoteadapter.doservice(coyoteadapter.java:331) @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:231) @ com.sun.enterprise.v3.services.impl.containermapper$adaptercallable.call(containermapper.java:317) @ com.sun.enterprise.v3.services.impl.containermapper.service(containermapper.java:195) @ com.sun.grizzly.http.processortask.invokeadapter(processortask.java:849) @ com.sun.grizzly.http.processortask.doprocess(processortask.java:746) @ com.sun.grizzly.http.processortask.process(processortask.java:1045) @ com.sun.grizzly.http.defaultprotocolfilter.execute(defaultprotocolfilter.java:228) @ com.sun.grizzly.defaultprotocolchain.executeprotocolfilter(defaultprotocolchain.java:137) @ com.sun.grizzly.defaultprotocolchain.execute(defaultprotocolchain.java:104) @ com.sun.grizzly.defaultprotocolchain.execute(defaultprotocolchain.java:90) @ com.sun.grizzly.http.httpprotocolchain.execute(httpprotocolchain.java:79) @ com.sun.grizzly.protocolchaincontexttask.docall(protocolchaincontexttask.java:54) @ com.sun.grizzly.selectionkeycontexttask.call(selectionkeycontexttask.java:59) @ com.sun.grizzly.contexttask.run(contexttask.java:71) @ com.sun.grizzly.util.abstractthreadpool$worker.dowork(abstractthreadpool.java:532) @ com.sun.grizzly.util.abstractthreadpool$worker.run(abstractthreadpool.java:513) @ java.lang.thread.run(thread.java:662)
caused by: com.sun.mail.smtp.smtpaddressfailedexception: 550 delivery not allowed address. @ com.sun.mail.smtp.smtptransport.rcptto(smtptransport.java:1686) ... 45 more
public void sendemail(action action) { if (action.getcopieaction() != null) { try { properties props = new properties(); string host = "localhost"; props.setproperty("mail.smtp.host", host); props.setproperty("mail.from", "sakina@transat.fr"); session session = session.getinstance(props); message message = new mimemessage(session); utilisateurdao user = new utilisateurdao(); // récupération du code user de l'utilisateur integer codeuserencopie = action.getcopieaction(); system.out.println(codeuserencopie); utilisateur util = user.finduserbycode(91); string mailusercopie = util.getemail(); system.out.println(mailusercopie); internetaddress recipient = new internetaddress(mailusercopie); message.setrecipient(message.recipienttype.to, recipient); message.setsubject("vous êtes en copie d'une action"); message.settext("bonjour, l'utilisateur " + action.getutilcreation() + " vous à mis en copie d'une action:" + "nom de l'action : " + action.getobjetaction() + "détails de l'action : " + action.gettexteaction() + "date de l'action : " + action.getdateaction()); transport.send(message); } catch (nosuchproviderexception e) { system.err .println("pas de transport disponible pour ce protocole"); system.err.println(e); } catch (addressexception e) { system.err.println("adresse invalide"); system.err.println(e); } catch (messagingexception e) { system.err.println("erreur dans le message"); system.err.println(e); } } }
delivry , sender adress same, have tried other adresses gmail or hotmail still same problem.
javamail best way send email using java.
the error comes mail server. it's complaining particular recipient address. you'll need check mail server configuration understand why doesn't want allow send address. might simple you've failed login mail server, doesn't know are, , won't let send address. protocol trace provide more details.
Comments
Post a Comment