commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ben Speakmon (JIRA)" <j...@apache.org>
Subject [jira] Commented: (EMAIL-6) [email] Errors when sending MultiPartEmail with another email as an attachment
Date Sat, 06 Jan 2007 01:00:27 GMT

    [ https://issues.apache.org/jira/browse/EMAIL-6?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462662
] 

Ben Speakmon commented on EMAIL-6:
----------------------------------

I was only able to get this to work by writing out the HtmlEmail as raw RFC822 to a file and
then using the existing attach() method. Ick. 

I can tell that what Dave's trying to do will definitely not work for a number of reasons,
but going into detail on each is probably unnecessary noise.

My judgment is that there's no way in the current MultiPartEmail API to do what Dave wants
to do; maybe an attach(Email email) method is called for. In any case, it seems within the
scope of commons-email to simplify attaching mails to other mails, and it's something the
current API cannot handle.

> [email] Errors when sending MultiPartEmail with another email as an attachment
> ------------------------------------------------------------------------------
>
>                 Key: EMAIL-6
>                 URL: https://issues.apache.org/jira/browse/EMAIL-6
>             Project: Commons Email
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Dave Cherkassky
>         Attachments: MultiPartEmailTest.java.patch
>
>
> Take a look at the code below:
> if( debugMode ) {
>   if( logger.isInfoEnabled() ) {
>     logger.info( "DEBUG mode is on.  Sending email to " + debugEmailAddress );
>   }
>   MultiPartEmail debugEmail = new MultiPartEmail();
>   if( logger.isDebugEnabled() ) {
>     debugEmail.setDebug( true );
>   }
>   debugEmail.setBounceAddress( debugEmailAddress );
>   debugEmail.setFrom( debugEmailAddress );
>   debugEmail.addReplyTo( debugEmailAddress );
>   debugEmail.addTo( debugEmailAddress );
>   debugEmail.setSubject( "Test Message: " + email.getSubject() );
>   debugEmail.setMsg( "The email manager is operating in test mode.  " +
>     "Attached is a message it would have sent had it been running for real." );
>   debugEmail.addPart( new MimeMultipart( 
>               new MimePartDataSource( email.getMimeMessage() ) ) );
>   debugEmail.setMailSession( emailSession );
>   messageId = debugEmail.send();
> }
> I get the following exception when I call debugEmail.send():
> 2006-03-12 09:07:01,140 [      main] INFO 
> com.djinnsoft.jade.email.EmailManager: DEBUG mode is on.  Sending email to
> test@djinnsoft.com
> 2006-03-12 09:07:01,640 [      main] WARN 
> com.djinnsoft.jade.email.EmailManager: Error emailing sent item 2000035: Sending
> the email to the following server failed : null:25
> javax.mail.SendFailedException: Sending failed;
>  nested exception is:
>   javax.mail.MessagingException: IOException while sending message;
>  nested exception is:
>   java.io.IOException: "text/plain" DataContentHandler requires String object,
> was given object of type class javax.mail.internet.MimeMultipart
>   at javax.mail.Transport.send0(Transport.java:219)
>   at javax.mail.Transport.send(Transport.java:81)
>   at org.apache.commons.mail.Email.sendMimeMessage(Email.java:863)
>   at org.apache.commons.mail.Email.send(Email.java:898)
>   at com.djinnsoft.jade.email.EmailManager.processMailing(EmailManager.java:1205)
> (line 1205 corresponds to "messageId = debugEmail.send();" in my code)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message