cs_franck09
Messages postés2Date d'inscriptionvendredi 15 septembre 2006StatutMembreDernière intervention18 septembre 2006
-
18 sept. 2006 à 10:57
imanota
Messages postés16Date d'inscriptiondimanche 21 septembre 2008StatutMembreDernière intervention28 mai 2010
-
28 mai 2010 à 17:44
Bonjour,
Je voudrais savoir comment on attache une pièce jointe lorsque l'on envoie un mail à la main en utilisant le protocole SMTP. Je sais qu'il faut encoder en MIME mais quelqu'un pourrait m'expliquer merci.
cs_franck09
Messages postés2Date d'inscriptionvendredi 15 septembre 2006StatutMembreDernière intervention18 septembre 2006 18 sept. 2006 à 14:06
Je ne recherche pas un code mais la ou les commandes utilisées par le protocole SMTP pour envoyer des mails avec une pièce jointe attachée. Je voudrais simplement avoir le détail pour attacher une pièce jointe.
(commande SMTP : helo, mail from:....) Je voudrais savoir celle pour attacher une pièce jointe merci.
imanota
Messages postés16Date d'inscriptiondimanche 21 septembre 2008StatutMembreDernière intervention28 mai 2010 28 mai 2010 à 17:44
slt,svp je veux envoyer un mail avec piece joint a partir d'un formulaire;j'ai voila le code que j'utilise,il ne me returne pas d'erreur ms ca marche pas,s'il vs plait qui peut m'aider;voila le code:
index.jsp:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
public class Mail {
//Ajout de la partie pièce jointe
private String to;
private String from;
private String message;
private String subject;
private String smtpServ;
private String nom;
//DataSource source;
private String filename;
public String getfilename() {
return filename;
}
public void setfilename(String filename) {
this.filename = filename;
}
public String getnom() {
return to;
}
public void setnom(String nom) {
this.nom = nom;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message; }
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getSmtpServ() {
return smtpServ;
}
public void setSmtpServ(String smtpServ) {
this.smtpServ = smtpServ;
}
public int sendMail(){
try
{
Properties props = System.getProperties();
// -- Attaching to default Session, or we could start a new one --
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.starttls.enable","true");
props.put("mail.smtp.host",smtpServ);
props.put("mail.smtp.auth", "true");
Authenticator auth = new SMTPAuthenticator();
Session session = Session.getInstance(props, auth);