473,405 Members | 2,338 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

[JAVAMAIL 1.3.1][SDK 1.4.2_04] - Cc-Header

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.sendpartial", "true");
Session session = Session.getDefaultInstance(props, 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(session);
DataHandler myData = new DataHandler(objBody,
"text/plain");

URLName myURL = new
URLName("SMTP",server,-1,"","applet","");
SMTPTransport myTra = new SMTPTransport(session, myURL);

myMsg.setReplyTo(replyto);
myMsg.setFrom(from);
if (copy != null) {
InternetAddress[] copyto = {new InternetAddress(copy)};
myMsg.setRecipients(Message.RecipientType.CC, copyto);
}

myMsg.setHeader("X-Mailer", "Applet Best-1.000-04/2004");
myMsg.setSentDate(new java.util.Date());
myMsg.setSubject(subject, "iso-8859-1");
myMsg.setDataHandler(myData);

SMTPMessage smtpMsg = new SMTPMessage((MimeMessage) myMsg);

myTra.connect();
myTra.sendMessage(smtpMsg, sendto);
}
catch (MessagingException mex) {
mex.printStackTrace();
Exception ex = null;
if ((ex = mex.getNextException()) != null) {
ex.printStackTrace();
}
}
}

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.1082539715500.JavaMail.javamailuser@local host>
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
Jul 17 '05 #1
0 1913

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: WEC | last post by:
Can anny one tell me 2 thingss 1) what is the curent SDK for java 2? 2) what is with the request for the password? WEC
1
by: Joshua | last post by:
Ive playedw ith the standard pop3 and imap and nntp and smtp modules but am unconvinced -- I would like to find a more sophisticated email handling API like JavaMail (from which I hope to convert)....
1
by: Trent | last post by:
Hello, all. Does anyone know if IBMJava2-SDK-1.4.2-0.0 work with DB2 8.2? I tried it with DB2 8.2 and got some error. This server is a RH3ES with kernel 2.4.21.4...
5
by: rengaraj | last post by:
Hello , I try a simple javamail program to send a mail.When i execute that javamail program, i got the error as follows import java.util.*; import javax.mail.*; import...
0
by: libia | last post by:
Hello, I want to send a mail using java program .so i used javamail 1.4 and jaf 1.1.It was compiled successfully.If i run the program it gives the error that "unable to connect" to port 25.If...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.