Hallo zusammen,
ich arbeite schon längere Zeit mit der Java Mail API. Allerdings bestanden die Mails bisher nur aus einem Absender und einem Empfänger. Heute wollte ich dann einmal einen Empfänger in Kopie hinzufügen, aber irgendwie will es mir nicht gelingen. Er wird zwar als CC in der Mail gesetzt, allerdings wird der Person keine Mail zugestellt.
Nun wäre meine Frage, ob einer von Euch einen Fehler in meinem Code sieht. Ich habe auch die Debugging Ausgabe der Mail API dazu geschrieben. Oder ist nur unser Notes Server zu doof.
[java=502] // Mail erstellen.
msg = new MimeMessage(this.session);
try {
msg.setFrom(message.getFrom());
} catch (MessagingException me) {
message.setLastException(new MailQueueException(
"Couldn't set sender address: " + message.getFrom(),
me), true);
this.reQueueMessage(message);
return;
}
try {
msg.setRecipient(Message.RecipientType.TO, message.getTo());
} catch (MessagingException me) {
message.setLastException(new MailQueueException(
"Couldn't set recipient address: " + message.getTo(),
me), true);
this.reQueueMessage(message);
return;
}
if ((message.getCopies() != null)
&& (message.getCopies().size() > 0)) {
addressIterator = message.getCopies().iterator();
while (addressIterator.hasNext()) {
ccAddress = addressIterator.next();
try {
msg.setRecipient(Message.RecipientType.CC, ccAddress);
} catch (MessagingException me) {
message.setLastException(new MailQueueException(
"Couldn't set carbon copie address: "
+ ccAddress, me), true);
this.reQueueMessage(message);
return;
}
}
}[/code]
Anmerkung: Ich habe einige Daten durch [[WERT]] ersetzt. Natürlich stehen hier in der Debugging Ausgabe der Mail API richtige Werte.
ich arbeite schon längere Zeit mit der Java Mail API. Allerdings bestanden die Mails bisher nur aus einem Absender und einem Empfänger. Heute wollte ich dann einmal einen Empfänger in Kopie hinzufügen, aber irgendwie will es mir nicht gelingen. Er wird zwar als CC in der Mail gesetzt, allerdings wird der Person keine Mail zugestellt.
Nun wäre meine Frage, ob einer von Euch einen Fehler in meinem Code sieht. Ich habe auch die Debugging Ausgabe der Mail API dazu geschrieben. Oder ist nur unser Notes Server zu doof.
[java=502] // Mail erstellen.
msg = new MimeMessage(this.session);
try {
msg.setFrom(message.getFrom());
} catch (MessagingException me) {
message.setLastException(new MailQueueException(
"Couldn't set sender address: " + message.getFrom(),
me), true);
this.reQueueMessage(message);
return;
}
try {
msg.setRecipient(Message.RecipientType.TO, message.getTo());
} catch (MessagingException me) {
message.setLastException(new MailQueueException(
"Couldn't set recipient address: " + message.getTo(),
me), true);
this.reQueueMessage(message);
return;
}
if ((message.getCopies() != null)
&& (message.getCopies().size() > 0)) {
addressIterator = message.getCopies().iterator();
while (addressIterator.hasNext()) {
ccAddress = addressIterator.next();
try {
msg.setRecipient(Message.RecipientType.CC, ccAddress);
} catch (MessagingException me) {
message.setLastException(new MailQueueException(
"Couldn't set carbon copie address: "
+ ccAddress, me), true);
this.reQueueMessage(message);
return;
}
}
}[/code]
Anmerkung: Ich habe einige Daten durch [[WERT]] ersetzt. Natürlich stehen hier in der Debugging Ausgabe der Mail API richtige Werte.
Code:
DEBUG: JavaMail version 1.3.3
DEBUG: java.io.FileNotFoundException: C:\Programme\Java\jre1.6.0_23\lib\javamail.providers (Das System kann die angegebene Datei nicht finden)
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.providers
DEBUG: successfully loaded resource: /META-INF/javamail.default.providers
DEBUG: Tables of loaded providers
DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}
DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: !anyLoaded
DEBUG: not loading resource: /META-INF/javamail.address.map
DEBUG: java.io.FileNotFoundException: C:\Programme\Java\jre1.6.0_23\lib\javamail.address.map (Das System kann die angegebene Datei nicht finden)
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "[[IPADRESSE_SERVER]]", port 25, isSSL false
220 [[NAME_SERVER]] ESMTP Service (Lotus Domino Release 7.0.2FP2) ready at Tue, 25 Jan 2011 12:17:10 +0100
DEBUG SMTP: connected to host "[[IPADRESSE_SERVER]]", port: 25
EHLO [[NAME_RECHNER]]
250-[[NAME_SERVER]] Hello <<RECHNERNAME>> ([[[IPADRESSE_RECHNER]]]), pleased to meet you
250-HELP
250-SIZE
250 PIPELINING
DEBUG SMTP: Found extension "HELP", arg ""
DEBUG SMTP: Found extension "SIZE", arg ""
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: use8bit false
MAIL FROM:<[[ADRESSE_ABSENDER]]>
250 [[ADRESSE_ABSENDER]]... Sender OK
RCPT TO:<[[ADRESSE_EMPFAENGER]]>
250 [[ADRESSE_EMPFAENGER]]... Recipient OK
DEBUG SMTP: Verified Addresses
DEBUG SMTP: [[NAME_EMPFAENGER]] <[[ADRESSE_EMPFAENGER]]>
DATA
354 Enter message, end with "." on a line by itself
Message-ID: <32170335.01295954213779.JavaMail.admin@[[NAME_RECHNER]]>
Date: Tue, 25 Jan 2011 12:16:53 +0100 (CET)
From: [[NAME_ABSENDER]] <[[ADRESSE_ABSENDER]]>
To: [[NAME_EMPFAENGER]] <[[ADRESSE_EMPFAENGER]]>
Subject: Test
Cc: [[NAME_KOPIE]] <[[ADRESSE_KOPIE]]>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Blabla Text blabla
.
250 Message accepted for delivery