james-server-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agks mehx <agksm...@gmail.com>
Subject Cannot access text/plain content of SMTP message in simple mailet
Date Tue, 11 Jan 2011 09:07:21 GMT

I cannot access the text content of a simple text/plain email sent to the
James SMTP server.  This is my first mailet and I got the same problem with
M2 and a recent M3-snapshot.

The following is the most simplified version of the source.  The following
code returns an *empty string*: String content =

After running the server, I telnet to port 25 and copy paste the following

helo private.com
mail from: <xyz@private.com>
rcpt to: <xyz@private.com>

Source of mailet follows:

package com.private.main.mailet;

import java.io.IOException;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;

import org.apache.mailet.Mail;
import org.apache.mailet.Mailet;
import org.apache.mailet.MailetConfig;

public class Test implements Mailet {

  protected MailetConfig mailet_config;

  public void init (MailetConfig mailet_config) {
    this.mailet_config = mailet_config;

  public void destroy () {

  public MailetConfig getMailetConfig () {
    return this.mailet_config;

  public String getMailetInfo () {
    return "Test Mailet";

  public void service (Mail mail) throws MessagingException {
    try {
      MimeMessage mime_message = mail.getMessage();
      System.out.println("content_type: " + mime_message.getContentType());
      if (mime_message.isMimeType("text/plain")) {
        String content = (String)mime_message.getContent();
    } catch (IOException e) {
      System.err.println("got an IOException:");


Thanks for any help!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message