Well, right now the way I have it setup is pretty simple, I have an xsp page that generates an email message(I made up some simili-MIME xml tags) then this goes thru an XSL file that transforms the output into a mime complient mail message, this is the input my MailSource receives, it implements a OutputStream and what I do is simply send the message when the close() method of the OutputStream is called, here is the source:

Right now, my problem is that if the email fails I know it has failed, but the only way for me to know why os to look at the logs.....

public class MailSource extends AbstractStreamWriteableSource implements WriteableSource {

        public MailSource( ComponentManager manager ) {
                super(manager);
        }
        
        public InputStream getInputStream() {
                return null;
        }
        
        public OutputStream getOutputStream() {
                return new MessageBuffer();
        }       
        
        public String getSystemId() {
                return "Email Source";
        }

class MessageBuffer extends ByteArrayOutputStream {
public void close() throws IOException {
super.close();
try {
Properties props = new Properties();
props.put( "mail.transport.protocol", "smtp" );
props.put( "mail.smtp.host", "localhost" );
Session mailSession = Session.getInstance( props, null );
MimeMessage mimeMessage = new MimeMessage( mailSession, new ByteArrayInputStream( toByteArray() ) );
Transport.send( mimeMessage );
} catch ( Exception e ) {
getLogger().error("Error sending email", e );
throw new IOException( "Unable to send email" );
}
}
}
}


If you have any ideas!(even if it involves changing the way I am thinking of doing this)

Ciao

Eric

What happens if your source just throws something like a ProcessingException when
it comes across an error. How does the SourceWritingTransformer handle that?


Regards, Upayavira



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to