[code]package br.gov.ce.seplag.cronmail.actions;
import java.util.Date;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;
import org.quartz.SchedulerException;
import br.gov.ce.seplag.cronmail.definicoes.EmailDefinicoes;
import com.opensymphony.xwork2.ActionSupport;
import freemarker.core.ParseException;
/**
- ActionSADMail é a ação responsável pelo envio de email para o módulo agendador do
- sistema SAD
- @author bernardo
*/
public class ActionSADMail extends ActionSupport{
private static final long serialVersionUID = 4881722358860240980L;
String hoje = new java.text.SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(new Date());
private String subject = "Aviso - CronMail - " + hoje;
public String execute(String emailTo, String nomeTo
, String msg) throws SchedulerException, ParseException
, InterruptedException, java.text.ParseException {
SimpleEmail email = new SimpleEmail();
email.setHostName(EmailDefinicoes.getServidorEmail());
try {
email.addTo(emailTo, nomeTo);
email.setFrom(EmailDefinicoes.getMsgFrom(), EmailDefinicoes.getNomeFrom());
//email.setSubject(EmailDefinicoes.getSubject());
email.setSubject(subject);
email.setMsg(msg);
email.send();
} catch (EmailException e) {
e.printStackTrace();
}
return SUCCESS;
}
}[/code]
to recebendo uma mensagem de errro quando to enviando email.
org.apache.commons.mail.EmailException: Sending the email to the following server failed : 172.25.4.24:25 at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1138) at org.apache.commons.mail.Email.send(Email.java:1163) at br.gov.ce.seplag.cronmail.actions.ActionSADMail.execute(ActionSADMail.java:40) at br.gov.ce.seplag.cronmail.jobs.JobSADVerificaAcoes.execute(JobSADVerificaAcoes.java:137) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)Caused by: javax.mail.MessagingException: 501 Command "HELO" requires an argument
que mudo para esse codigo dar certo?