Problem sending mails
rodosa Mar 26, 2008 5:47 AMHello!!
I'm trying sending mails but I don't get it. I've tried two differents ways to do it.
1) Mail-node. It's code is:
<mail-node name="Enviar notificacion" to="xxx@hotmail.com"> <subject> Prueba </subject> <text> Prueba Jbpm </text> <transition to="Fin" name="t2"></transition> </mail-node>
and jbpm.cgf is
<jbpm-configuration> <!-- The default configurations can be found in org/jbpm/default.jbpm.cfg.xml Those configurations can be overwritten by putting this file called jbpm.cfg.xml on the root of the classpath and put in the customized values. --> <string name="jbpm.mail.smtp.host" value="smtp.xxx.es" /> <bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResolver" singleton="true" /> <string name="jbpm.mail.user" value="xxx" /> <string name="jbpm.mail.pass" value="xxx" /> <string name="jbpm.mail.from.address" value="xxx@gmail.com"/> <string name="jbpm.mail.port" value="25" /> <string name="jbpm.mail.smtp.auth" value="true" /> <string name="jbpm.mail.debug" value="true" /> </jbpm-configuration>
It doesn't work. If I put the jbpm.mail.smtp.auth a true the authentication fail, and if I put it to false the error is this:
Recipient address rejected: Access denied 554 + "Invalid Addresses"
2) The second way is declare a node in which handler I try to send a mail. But occurs the similar problem:
package handlers; import java.util.ArrayList; import java.util.List; import java.util.Properties; import org.jbpm.JbpmConfiguration; import org.jbpm.graph.def.ActionHandler; import org.jbpm.graph.exe.ExecutionContext; import org.jbpm.mail.Mail; public class MyMailAction implements ActionHandler { private static final long serialVersionUID = 1L; public void execute(ExecutionContext context) throws Exception { System.out.println("---->>>Estoy en execution context"); try { JbpmConfiguration.Configs.getObject("jbpm.mail.smtp.host"); Properties p = new Properties(); p.put("mail.smtp.host", JbpmConfiguration.Configs.getObject("jbpm.mail.smtp.host")); //p.put("mail.smtp.port", JbpmConfiguration.Configs.getObject("jbpm.mail.port")); p.put("mail.smtp.auth", JbpmConfiguration.Configs.getObject("jbpm.mail.smtp.auth")); p.put("mail.smtp.user", JbpmConfiguration.Configs.getObject("jbpm.mail.user")); p.put("mail.smtp.password", JbpmConfiguration.Configs.getObject("jbpm.mail.pass")); p.put("mail.debug", JbpmConfiguration.Configs.getObject("jbpm.mail.debug")); p.put("mail.from.address", JbpmConfiguration.Configs.getObject("jbpm.mail.from.address")); p.put("mail.class.name", JbpmConfiguration.Configs.getObject("mail.class.name")); List l = new ArrayList(); l.add("xxxx@hotmail.com"); Mail.send(p, "sss@gmail.com",l, "The subject", "The text"); } catch (Exception e ) { e.printStackTrace(); } System.out.println("---->>>Estoy en execution context"); } }
I realized that exist mail-service.xml ... It's using this file. How can I dolve this?
Thanks