Le Forum Non Officiel de la DEDIBOX
Vous n'êtes pas identifié.
Bonjour,
je suis sous kubuntu et j'ai besoin d'envoyer des mails aux utilisateur de mon site... Simple à dire ![]()
Je développe en Java, voilà mon petit bout de code :
private static void send(String smtpServer, String to, String cc, String from, String subject, String body)
{
try
{
Properties props = System.getProperties();
props.put("mail.smtp.host", smtpServer);
Session session = Session.getDefaultInstance(props, null);
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
msg.setRecipients(javax.mail.Message.RecipientType.TO, InternetAddress.parse(to, false));
if(cc != null)
msg.setRecipients(javax.mail.Message.RecipientType.CC, InternetAddress.parse(cc, false));
msg.setSubject(subject);
msg.setText(body);
msg.setHeader("X-Mailer", "LOTONtechEmail");
msg.setSentDate(new Date());
logger.info("smtpServer = "+ smtpServer);
Transport.send(msg);
}
catch(Exception ex)
{
ex.printStackTrace();
}
}Il y a quelques mois j'avais installé un server smtp sur la même distribution (xmail je crois), je ne me souviens plus trop comment j'avais fait à l'époque, mais après avoir rempli le petit wizard lors de l'installation et en settant le nom du serverSmtp à sd-xxxx (nom de ma dedibox), le code marchait parfaitement bien...
Seulement depuis il s'est passé un truc que j'ignore et voilà que rien ne marche plus pour l'envoi des mails depuis un reboot hardware d'il y a 8 jours...
Du coup j'ai évidement essayé de tout traficote et j'ai désinstallé le server, j'ai installé postfix pour essayé, exim4 et reinstallé xmail etc...
Mais je n'arrive plus à envoyer de mail alors que mon port sortant est bien débloqué...
Quand je regarde les logs du server xmail ou même de postfix je n'avais pas d'erreur particulière mais je pense que je dois me gourer dans la configuration
Côté serveur web j'ai ce message d'erreur :
2007-09-22 17:07:35 INFO [SignAction] smtpServer = sd-xxxx
javax.mail.SendFailedException: Sending failed;
nested exception is:
class javax.mail.MessagingException: 501 Syntax error in return path
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at com.WarEngine.action.SignAction.send(SignAction.java:122)
at com.WarEngine.action.SignAction.execute(SignAction.java:101)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)ça plus de 5h d'affiliées que j'essaye de trouver une solution, un autre serveur smtp, n'importe quoi qui puisse me faire utiliser ce bout de code, qui marche parfaitement...
Je commence à désespérer alors si une bonne âme a une idée, elle me sauvera le week end
ps : pour info je n'arrive plus non plus à taper la commande > mail xxx@xxx.com, j'ai le droit à un message bash comme quoi il ne trouve pas la commande.. :-(
merci
ludo
Hors ligne