ruanwenjun opened a new issue #5369:
URL: https://github.com/apache/dolphinscheduler/issues/5369


   **Describe the bug**
   When I send an email with attach file, there will be an error in 
`alert-server`.
   ```java
   23:21:37.649 [pool-7-thread-1] ERROR 
org.apache.dolphinscheduler.plugin.alert.email.MailSender - Send email to 
[[email protected]] failed
   javax.mail.MessagingException: IOException while sending message
        at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1365)
        at javax.mail.Transport.send0(Transport.java:255)
        at javax.mail.Transport.send(Transport.java:124)
        at 
org.apache.dolphinscheduler.plugin.alert.email.MailSender.attachContent(MailSender.java:358)
        at 
org.apache.dolphinscheduler.plugin.alert.email.MailSender.attachment(MailSender.java:261)
        at 
org.apache.dolphinscheduler.plugin.alert.email.MailSender.sendMails(MailSender.java:211)
        at 
org.apache.dolphinscheduler.plugin.alert.email.MailSender.sendMails(MailSender.java:147)
        at 
org.apache.dolphinscheduler.plugin.alert.email.EmailAlertChannel.process(EmailAlertChannel.java:45)
        at 
org.apache.dolphinscheduler.alert.runner.AlertSender.alertResultHandler(AlertSender.java:162)
        at 
org.apache.dolphinscheduler.alert.runner.AlertSender.syncHandler(AlertSender.java:126)
        at 
org.apache.dolphinscheduler.alert.processor.AlertRequestProcessor.process(AlertRequestProcessor.java:60)
        at 
org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:123)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
        at java.util.concurrent.FutureTask.run(FutureTask.java)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
   Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for 
MIME type multipart/mixed; 
        boundary="----=_Part_0_2080677060.1619191291188"
        at 
javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:896)
        at javax.activation.DataHandler.writeTo(DataHandler.java:317)
        at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1694)
        at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1913)
        at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1315)
        ... 17 common frames omitted
   ```
   
   After set 
`Thread.currentThread().setContextClassLoader(getClass().getClassLoader());` 
this problem can be fixed. I'm not sure if this is a common problem. 
   
https://stackoverflow.com/questions/21856211/javax-activation-unsupporteddatatypeexception-no-object-dch-for-mime-type-multi
   
   **To Reproduce**
   1.  Execute a sql task
   2. Send email with attachment
   
   **Which version of Dolphin Scheduler:**
    -[1.3.6]
    -[dev]
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to