how do you do that ?
Steve Short a écrit :
Why don't you enable debug logging for the spool manager, run your test and
look at the log produced - it should tell you eaxactly whay James has done with
the email.
Steve
-----Original Message-----
From: Thibaut [mailto:[EMAIL PROTECTED]
Sent: Thursday, April 13, 2006 10:50 AM
To: James Users List
Subject: Re: send mail
I wrote this code in the mailet and the mail i create goes to
the root processor then in the transport processor.
I've tried exactly this code :
Collection recipients = new ArrayList();
recipients.add("[EMAIL PROTECTED]");
MailImpl newMail = new MailImpl("toto", new
MailAddress("[EMAIL PROTECTED]"), recipients);
try {
newMail.setRemoteAddr(java.net.InetAddress.getLocalHost().getH
ostAddress());
newMail.setRemoteHost(java.net.InetAddress.getLocalHost().getH
ostName());
} catch (java.net.UnknownHostException _) {
newMail.setRemoteAddr("127.0.0.1");
newMail.setRemoteHost("localhost");
}
and it doesn't work ...
Stefano Bagnara a écrit :
Where did you write this code?
To send a new mail from a mailet you simply have to use the
getMailetContext().sendMail(newMail); where newMail is the new mail
you want to write.
MailImpl newMail = new MailImpl(<your preferred constructor>);
I suggesto you to add this code after the newMail creation:
try {
newMail.setRemoteAddr(java.net.InetAddress.getLocalHost().getH
ostAddress());
newMail.setRemoteHost(java.net.InetAddress.getLocalHost().getH
ostName());
} catch (java.net.UnknownHostException _) {
newMail.setRemoteAddr("127.0.0.1");
newMail.setRemoteHost("localhost");
}
Using getMailetContext().sendMail() the new mail is stored to the
spool and James handle it like any other incoming mail. (Be
sure you
avoid loops using specific Matchers).
If you set a specific State (setState) to the message before using
sendMail then the mail will start from the processor with that name.
Stefano
Thibaut wrote:
hi,
I receive email on the port 25. I try to send email from the james
server (to confirm the reception).
I do :
Properties props = System.getProperties();
props.put("mail.smtp.host", "localhost");
Session session = Session.getDefaultInstance(props,
null);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(this.from));
InternetAddress adresTo = new InternetAddress(to);
message.addRecipient(Message.RecipientType.TO, adresTo);
message.setSubject(subject);
message.setContent(content, "text/html");
javax.mail.Transport.send(message);
but this doesn't work.
I read http://james.apache.org/FAQ.html#3 but i can't
figure out the
solution.
Can anyone help me ?
Thibaut
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]