javax.mail.Message.setDataHandler()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(184)

本文整理了Java中javax.mail.Message.setDataHandler()方法的一些代码示例,展示了Message.setDataHandler()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setDataHandler()方法的具体详情如下:
包路径:javax.mail.Message
类名称:Message
方法名:setDataHandler

Message.setDataHandler介绍

暂无

代码示例

代码示例来源:origin: kiegroup/jbpm

msg.setDataHandler( new DataHandler( new ByteArrayDataSource( body, "text/html" ) ) );

代码示例来源:origin: google/mail-importer

@Override
public void setDataHandler(DataHandler dh) throws RuntimeMessagingException {
 try {
  delegate.setDataHandler(dh);
 } catch (MessagingException e) {
  throw new RuntimeMessagingException(e);
 }
}

代码示例来源:origin: stackoverflow.com

Message message = new MimeMessage(session);
   message.setDataHandler(new DataHandler(new ByteArrayDataSource(csv.getBytes("8859_8"),
       "text/csv")));
   message.setFileName("data.csv");
   message.setFrom(new InternetAddress(from));
   message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
   message.setSubject("Query report...");
   Transport.send(message);
   LOG.info("Sent message successfully ...");

代码示例来源:origin: spring-projects/spring-ws

@Override
protected void onSendAfterWrite(WebServiceMessage message) throws IOException {
  Transport transport = null;
  try {
    responseMessage.setDataHandler(
        new DataHandler(new ByteArrayDataSource(responseContentType, responseBuffer.toByteArray())));
    transport = session.getTransport(transportUri);
    transport.connect();
    responseMessage.saveChanges();
    transport.sendMessage(responseMessage, responseMessage.getAllRecipients());
  }
  catch (MessagingException ex) {
    throw new MailTransportException(ex);
  }
  finally {
    MailTransportUtils.closeService(transport);
  }
}

代码示例来源:origin: apache/servicemix-bundles

@Override
protected void onSendAfterWrite(WebServiceMessage message) throws IOException {
  Transport transport = null;
  try {
    responseMessage.setDataHandler(
        new DataHandler(new ByteArrayDataSource(responseContentType, responseBuffer.toByteArray())));
    transport = session.getTransport(transportUri);
    transport.connect();
    responseMessage.saveChanges();
    transport.sendMessage(responseMessage, responseMessage.getAllRecipients());
  }
  catch (MessagingException ex) {
    throw new MailTransportException(ex);
  }
  finally {
    MailTransportUtils.closeService(transport);
  }
}

代码示例来源:origin: org.springframework.ws/spring-ws-support

@Override
protected void onSendAfterWrite(WebServiceMessage message) throws IOException {
  Transport transport = null;
  try {
    responseMessage.setDataHandler(
        new DataHandler(new ByteArrayDataSource(responseContentType, responseBuffer.toByteArray())));
    transport = session.getTransport(transportUri);
    transport.connect();
    responseMessage.saveChanges();
    transport.sendMessage(responseMessage, responseMessage.getAllRecipients());
  }
  catch (MessagingException ex) {
    throw new MailTransportException(ex);
  }
  finally {
    MailTransportUtils.closeService(transport);
  }
}

代码示例来源:origin: lutece-platform/lutece-core

msg.setDataHandler( new DataHandler( new ByteArrayDataSource( strMessage, AppPropertiesService.getProperty( PROPERTY_MAIL_TYPE_PLAIN )
    + AppPropertiesService.getProperty( PROPERTY_CHARSET ) ) ) );

代码示例来源:origin: org.jbpm/jbpm-workitems-email

msg.setDataHandler(new DataHandler(new ByteArrayDataSource(message.getBody(),
                              "text/html")));

代码示例来源:origin: lutece-platform/lutece-core

msg.setDataHandler( new DataHandler( new ByteArrayDataSource( strMessage, AppPropertiesService.getProperty( PROPERTY_MAIL_TYPE_HTML )
    + AppPropertiesService.getProperty( PROPERTY_CHARSET ) ) ) );

相关文章