hi together.
public void sendMail(String body, String subject, String sender, String to,
String copy) {
String server = "srv.domain.com ";
String toList = null;
Properties props = new Properties();
props.put("mail .smtp.host", server);
props.put("mail .smtp.sendparti al", "true");
Session session = Session.getDefa ultInstance(pro ps, null);
try {
InternetAddress from = new InternetAddress (sender,true);
InternetAddress[] replyto = {new InternetAddress (sender,true)};
InternetAddress[] sendto = {new InternetAddress (to)};
Object objBody = new String(body);
MimeMessage myMsg = new MimeMessage(ses sion);
DataHandler myData = new DataHandler(obj Body,
"text/plain");
URLName myURL = new
URLName("SMTP", server,-1,"","applet"," ");
SMTPTransport myTra = new SMTPTransport(s ession, myURL);
myMsg.setReplyT o(replyto);
myMsg.setFrom(f rom);
if (copy != null) {
InternetAddress[] copyto = {new InternetAddress (copy)};
myMsg.setRecipi ents(Message.Re cipientType.CC, copyto);
}
myMsg.setHeader ("X-Mailer", "Applet Best-1.000-04/2004");
myMsg.setSentDa te(new java.util.Date( ));
myMsg.setSubjec t(subject, "iso-8859-1");
myMsg.setDataHa ndler(myData);
SMTPMessage smtpMsg = new SMTPMessage((Mi meMessage) myMsg);
myTra.connect() ;
myTra.sendMessa ge(smtpMsg, sendto);
}
catch (MessagingExcep tion mex) {
mex.printStackT race();
Exception ex = null;
if ((ex = mex.getNextExce ption()) != null) {
ex.printStackTr ace();
}
}
}
those function send mail and works, except the copyto user. he gets no mail.
the mail looks...:
Return-Path: <replyto>
Delivered-To: from
Received: from srv.domain.com (srv.domain.com [192.168.1.45])
by mail.domain.com (Postfix) with ESMTP id BF02B9A404D
for <sendto>; Wed, 21 Apr 2004 11:28:36 +0200 (CEST)
Received: from localhost (dv02na.domain. com [192.168.1.70])
by srv.domain.com (8.11.6/8.11.6) with ESMTP id i3L9STr03234
for <sendto>; Wed, 21 Apr 2004 11:28:29 +0200
Message-ID: <5626111.108253 9715500.JavaMai l.javamailuser@ localhost>
Date: Wed, 21 Apr 2004 11:28:35 +0200 (CEST)
From: from Reply-To: replyto
Subject: Bestellung Artikel
Cc: copyto
Mime-Version: 1.0
Content-Type: text/plain; charset=Cp1252
Content-Transfer-Encoding: quoted-printable
X-Mailer: JavaClient/Applet Best-1.000-04/2004
....
i have changed the mail system values to the var names in the source, they
are ok.
the header sequence is unchanged.
a look in source shows, that the cc-header is in third place, if exists.
in the produced mail the cc-header is behind the subject-header. causes
these the trouble?
thanks in advance
volker