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

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

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

Message.setContent介绍

暂无

代码示例

代码示例来源:origin: log4j/log4j

msg.setContent(mp);

代码示例来源:origin: pentaho/pentaho-kettle

msg.setContent( ArgList[4], "text/plain" );
 Transport.send( msg );
} catch ( Exception e ) {

代码示例来源:origin: azkaban/azkaban

message.setContent(multipart);
} else {
 message.setContent(this._body.toString(), this._mimeType);

代码示例来源:origin: pentaho/pentaho-kettle

msg.setContent( ArgList[4], "text/plain" );
 Transport.send( msg );
} catch ( Exception e ) {

代码示例来源:origin: javamelody/javamelody

msg.setContent(multipart);

代码示例来源:origin: pentaho/pentaho-kettle

msg.setContent( data.parts );

代码示例来源:origin: JpressProjects/jpress

@Override
  public void send(Email email) {
    if (enable == false) {
      //do nothing
      return;
    }

    Message message = createMessage();
    try {
      message.setSubject(email.getSubject());
      message.setContent(email.getContent(), "text/html;charset=utf-8");

      message.setRecipients(Message.RecipientType.TO, toAddress(email.getTo()));
      message.setRecipients(Message.RecipientType.CC, toAddress(email.getCc()));

      Transport.send(message);
    } catch (MessagingException e) {
      logger.error("SimpleEmailSender send error", e);
    }

  }
}

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

msg.setContent(multipart);
} else {
  msg.setDataHandler( new DataHandler( new ByteArrayDataSource( body, "text/html" ) ) );

代码示例来源:origin: pentaho/pentaho-kettle

msg.setContent( parts );

代码示例来源:origin: apache/nifi

message.setContent(messageText, contentType);
message.setSentDate(new Date());
  multipart.addBodyPart(mimeText);
  multipart.addBodyPart(mimeFile);
  message.setContent(multipart);

代码示例来源:origin: apache/nifi

@Override
public void notify(final NotificationContext context, final NotificationType notificationType, final String subject, final String messageText) throws NotificationFailedException {
  final Properties properties = getMailProperties(context);
  final Session mailSession = createMailSession(properties);
  final Message message = new MimeMessage(mailSession);
  try {
    message.setFrom(InternetAddress.parse(context.getProperty(FROM).evaluateAttributeExpressions().getValue())[0]);
    final InternetAddress[] toAddresses = toInetAddresses(context.getProperty(TO).evaluateAttributeExpressions().getValue());
    message.setRecipients(RecipientType.TO, toAddresses);
    final InternetAddress[] ccAddresses = toInetAddresses(context.getProperty(CC).evaluateAttributeExpressions().getValue());
    message.setRecipients(RecipientType.CC, ccAddresses);
    final InternetAddress[] bccAddresses = toInetAddresses(context.getProperty(BCC).evaluateAttributeExpressions().getValue());
    message.setRecipients(RecipientType.BCC, bccAddresses);
    message.setHeader("X-Mailer", context.getProperty(HEADER_XMAILER).evaluateAttributeExpressions().getValue());
    message.setSubject(subject);
    final String contentType = context.getProperty(CONTENT_TYPE).evaluateAttributeExpressions().getValue();
    message.setContent(messageText, contentType);
    message.setSentDate(new Date());
    Transport.send(message);
  } catch (final ProcessException | MessagingException e) {
    throw new NotificationFailedException("Failed to send E-mail Notification", e);
  }
}

代码示例来源:origin: rakam-io/rakam

msg.setContent(mp);

代码示例来源:origin: apache/log4j

msg.setContent(mp);

代码示例来源:origin: tomoya92/pybbs

message.setContent(content, "text/html;charset=UTF-8");

代码示例来源:origin: opensourceBIM/BIMserver

message.setSubject(subject);
message.setRecipients(to, addressTo);
message.setContent(body, contentType);
message.setFrom(from);

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

@Override
public void setContent(Object obj, String type)
  throws RuntimeMessagingException {
 try {
  delegate.setContent(obj, type);
 } catch (MessagingException e) {
  throw new RuntimeMessagingException(e);
 }
}

代码示例来源:origin: dkpro/dkpro-jwpl

private void send() {
  try {
    Message msg = initMessage();
    msg.setContent(messageBuffer.toString(), "text/plain");
    Transport.send(msg);
  } catch (Exception e) {
    logger.error("Unable to send message", e);
  }
}

代码示例来源:origin: de.tudarmstadt.ukp.wikipedia/de.tudarmstadt.ukp.wikipedia.wikimachine

private void send() {
  try {
    Message msg = initMessage();
    msg.setContent(messageBuffer.toString(), "text/plain");
    Transport.send(msg);
  } catch (Exception e) {
    log4j.error("Unable to send message", e);
  }
}

代码示例来源:origin: org.aperteworkflow/aperte-utils

public void sendEmail(String rcpt, String from, String subject, String body, boolean sendHtml, Session mailSession) throws MessagingException {
  Message message = new MimeMessage(mailSession);
  message.setFrom(new InternetAddress(from));
  message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(rcpt));
  message.setSubject(subject);
  message.setContent(body, sendHtml ? "text/html" : "text/plain");
  Transport.send(message);
}

代码示例来源:origin: org.evolvis.bsi/kolab-ws

public static void
IMAPMessage_setContent(Message message, MimeMultipart multipart)
throws MessagingException
{
  if (!Profiler.INSTANCE.isActive()) // only needed for better performance
    message.setContent(multipart);
  else
    profileInvokeMExcep(message, "setContent", multipart);
}

相关文章