You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Sujit Jagdev <Su...@casero.com> on 2005/03/03 16:01:52 UTC
re: sending smtp messages from a mailet
We have been trying to send emails from within an email using the
javax.mail package. But, James keeps intercepting the message even
though it is destined for another mail server.
Here is a code snippet.
Session mailSession = Session.getDefaultInstance(mailConfig, null);
MimeMessage msg = new MimeMessage(mailSession);
msg.setFrom(new
InternetAddress(this.mailConfig.getProperty("mail.from")));
msg.setRecipients(Message.RecipientType.TO,
message.getFrom());
msg.setSubject("Account Creation");
msg.setContent(or.getMessage(), "text/plain");
Transport trans =
mailSession.getTransport(message.getFrom()[0]);
trans.connect(this.getMailetConfig().getInitParameter("mailHost"),
"username", "password");
Transport.send(msg);
trans.close();
The code works when I run it outside JAMES. So my question is how do I,
get JAMES to stop spooling any emails that I create and send from inside
a mailet.
Sujit
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
Re: sending smtp messages from a mailet
Posted by Serge Knystautas <se...@lokitech.com>.
Sujit Jagdev wrote:
> We have been trying to send emails from within an email using the
> javax.mail package. But, James keeps intercepting the message even
> though it is destined for another mail server.
>
> Here is a code snippet.
You could use this, or instead of the Transport, you could use
MailetContext.sendMail. See the mailet API docs at
http://james.apache.org/mailet/index.html.
> The code works when I run it outside JAMES. So my question is how do I,
> get JAMES to stop spooling any emails that I create and send from inside
> a mailet.
I don't quite understand... why do you want to stop spooling any emails,
and what are you hoping to accomplish?
--
Serge Knystautas
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org