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 Jerome Lacoste <la...@frisurf.no> on 2003/12/03 19:45:24 UTC

MimeMessage factory

Hi,

I am new to the java mail API and I need to parse a create a
javax.mail.Message out of a text file. What is the best solution to do
so?

Should I use a sort of mbox implementation to do so? Or should I write
my own code?

Jerome



Re: MimeMessage factory

Posted by Jerome Lacoste <la...@frisurf.no>.
On Wed, 2003-12-03 at 20:25, Serge Knystautas wrote:
> Jerome Lacoste wrote:
> > I am new to the java mail API and I need to parse a create a
> > javax.mail.Message out of a text file. What is the best solution to do
> > so?
> > 
> > Should I use a sort of mbox implementation to do so? Or should I write
> > my own code?
> 
> Well, what's in the text file?

it was a message in plain text (with headers). I found that I just
needed to do the following:

    Session session = Session.getDefaultInstance(new Properties());
    InputStream inputStream =
this.getClass().getClassLoader().getResourceAsStream(inputFileName);
    if (inputStream != null)
    {
      Message message = return new MimeMessage(session, inputStream);
    }

So I am happy with that.

Thanks

jerome

RE: recovering mail from deadletter table

Posted by "Noel J. Bergman" <no...@devtech.com>.
> would like to re-process the mail for delivery to local James accounts.

See the FromRepository mailet in CVS.

	--- Noel

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: recovering mail from deadletter table

Posted by Serge Knystautas <se...@lokitech.com>.
Robert J Taylor wrote:
> Update: I used an insert into...select query (modifying repository to the
> proper recipient's local address, and setting message_state and
> error_message to Null) to put the deadletters in the inbox table. I would
> imagine this is not optimal since it presumably skips all the mailet logic,
> correct?
> 
> What is a better way to do this?

insert into... select query will duplicate the message (create a copy in 
the new location).  You probably just want to do an update statement to 
move them.

You can either stick the messages in the root spool processor to have it 
go through all mailet execution, a particular spool processor, or a 
different mailbox, so you can get it to do as much or as little of the 
mailet processing as you'd like.

-- 
Serge Knystautas
President
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


odd send recieve behavior

Posted by Tim Neukum <ne...@olin.wustl.edu>.
I've got my james server up and running but this is very odd.
Some domains accept email sent to them but can't send to me and vice
versa.

For example I can send to user_at_olin.wustl.edu from mydomain.com but I
can't send from user_at_olin.wustl.edu to mydomain.com . The olin
account uses it's own smtp server but I'm using james as my smtp server
for mydomain.com.

As another example I can send from mydomain.com to yahoo.com and
likewise send from yahoo.com to mydomain.com. Obviously this is the
desired behavior.

In a message from postmaster_at_mydomain.com I get a message about not
being able to deliver to user_at_netscape.net

"Could not connect to SMTP host mailin-02.mx.netscape.net., port: 25"

But on the other hand user_at_netscape.net can send mail to
mydomain.com.


What is going on here??!??

Tim


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


RE: recovering mail from deadletter table

Posted by Robert J Taylor <rt...@10thdegree.com>.
Update: I used an insert into...select query (modifying repository to the
proper recipient's local address, and setting message_state and
error_message to Null) to put the deadletters in the inbox table. I would
imagine this is not optimal since it presumably skips all the mailet logic,
correct?

What is a better way to do this?

-----Original Message-----
From: Robert J Taylor [mailto:postmaster@rjamestaylor.com]
Sent: Wednesday, December 03, 2003 1:02 PM
To: James Users List
Subject: recovering mail from deadletter table


Hello again.

We're using MySQL for our repository and have noticed a number of messages
that are in deadletter (due to one or more configuration reasons that have
been fixed) and would like to re-process the mail for delivery to local
James accounts.

How should we do this?

Thanks,

Robert Taylor


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


recovering mail from deadletter table

Posted by Robert J Taylor <po...@rjamestaylor.com>.
Hello again.

We're using MySQL for our repository and have noticed a number of messages
that are in deadletter (due to one or more configuration reasons that have
been fixed) and would like to re-process the mail for delivery to local
James accounts.

How should we do this?

Thanks,

Robert Taylor


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: MimeMessage factory

Posted by Serge Knystautas <se...@lokitech.com>.
Jerome Lacoste wrote:
> I am new to the java mail API and I need to parse a create a
> javax.mail.Message out of a text file. What is the best solution to do
> so?
> 
> Should I use a sort of mbox implementation to do so? Or should I write
> my own code?

Well, what's in the text file?

-- 
Serge Knystautas
President
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


RE: Adding HTML to the beginning of all messages passing through James

Posted by "Noel J. Bergman" <no...@devtech.com>.
> I am currently trying to write a Mailet to add a
> text/html content-type BodyPart to the beginning of
> all emails that pass through James

See the AddFooter mailet.

	--- Noel

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Adding HTML to the beginning of all messages passing through James

Posted by JJ <uk...@yahoo.com>.
I am currently trying to write a Mailet to add a
text/html content-type BodyPart to the beginning of
all emails that pass through James, regardless of
whether they are multipart.

I have tried various approaches but all result in the
newly created multipart message content being
displayed incorrectly. What should the content-type of
the new message be: "multipart/mixed",
"multipart/alternative"?? Both of these don't seem to
work for me.

The body of my service method is as follows:

{
  MimeMessage message = mail.getMessage();
  Multipart multiPart = new MimeMultipart();

  BodyPart bodyPart = new MimeBodyPart();
  
  //HTML is a String reference to my html content
  bodyPart.setContent(HTML, "text/html");
  bodyPart.setHeader("Content-Type", "text/html");
  multiPart.addBodyPart(bodyPart);

  bodyPart = new MimeBodyPart();
  bodyPart.setDataHandler(message.getDataHandler());
  multiPart.addBodyPart(bodyPart);

  message.setContent(multiPart);
  message.setHeader("Content-Type",
"multipart/mixed");
}

Any help with this would be extremely welcome.

Thanks in advance,

Jonathan

  





__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org