Java 类org.springframework.mail.javamail.MimeMailMessage 实例源码

项目:omero-ms-queue    文件:MessageBuilder.java   
public MimeMessage buildMimeMessage(PlainTextMail data) {
    requireNonNull(data, "data");

    MimeMailMessage builder = mimeBuilder();
    builder.setFrom(config.fromAddress().get());
    builder.setTo(data.getRecipient().get());
    builder.setSubject(data.getSubject());
    builder.setText(data.getContent());

    return builder.getMimeMessage();
}
项目:imap2smtp    文件:JavaMailForwarder.java   
public void forward(Address[] forwardTo, SimpleMailMessage... simpleMessages) throws MailException {
    List<MimeMessage> mimeMessages = new ArrayList<MimeMessage>(simpleMessages.length);
    for (SimpleMailMessage simpleMessage : simpleMessages) {
        MimeMailMessage message = new MimeMailMessage(createMimeMessage());
        simpleMessage.copyTo(message);
        mimeMessages.add(message.getMimeMessage());
    }
    doForward(forwardTo, mimeMessages.toArray(new MimeMessage[mimeMessages.size()]), simpleMessages);
}
项目:r01fb    文件:JavaMailSenderImplBase.java   
@Override
public void send(final SimpleMailMessage[] simpleMessages) throws MailException {
    List<MimeMessage> mimeMessages = new ArrayList<MimeMessage>(simpleMessages.length);
    for (SimpleMailMessage simpleMessage : simpleMessages) {
        MimeMailMessage message = new MimeMailMessage(createMimeMessage());
        simpleMessage.copyTo(message);
        mimeMessages.add(message.getMimeMessage());
    }
    _doSend(mimeMessages.toArray(new MimeMessage[mimeMessages.size()]),
            simpleMessages);
}
项目:ome-smuggler    文件:MessageBuilder.java   
public MimeMessage buildMimeMessage(PlainTextMail data) {
    requireNonNull(data, "data");

    MimeMailMessage builder = mimeBuilder();
    builder.setFrom(config.fromAddress().get());
    builder.setTo(data.getRecipient().get());
    builder.setSubject(data.getSubject());
    builder.setText(data.getContent());

    return builder.getMimeMessage();
}
项目:kfs    文件:AttachmentMailerImpl.java   
/**
 * Construct and a send mime email message from an Attachment Mail Message.
 *
 * @param message the Attachement Mail Message
 * @throws MessagingException
 */
@Override
public void sendEmail(AttachmentMailMessage message) throws MessagingException {
    // Construct a mime message from the Attachment Mail Message

    MimeMessage mimeMessage = mailSender.createMimeMessage();

    MimeBodyPart body = new MimeBodyPart();
    body.setText(message.getMessage());

    MimeBodyPart attachment = new MimeBodyPart();
    Multipart multipart = new MimeMultipart();
    multipart.addBodyPart(body);
    ByteArrayDataSource ds = new ByteArrayDataSource(message.getContent(), message.getType());
    attachment.setDataHandler(new DataHandler(ds));
    attachment.setFileName(message.getFileName());
    multipart.addBodyPart(attachment);
    mimeMessage.setContent(multipart);

    MimeMailMessage mmm = new MimeMailMessage(mimeMessage);

    mmm.setTo( (String[])message.getToAddresses().toArray(new String[message.getToAddresses().size()]) );
    mmm.setBcc( (String[])message.getBccAddresses().toArray(new String[message.getBccAddresses().size()]) );
    mmm.setCc( (String[])message.getCcAddresses().toArray(new String[message.getCcAddresses().size()]) );
    mmm.setSubject(message.getSubject());
    mmm.setFrom(message.getFromAddress());

    try {
        if ( LOG.isDebugEnabled() ) {
            LOG.debug( "sendEmail() - Sending message: " + mmm.toString() );
        }
        mailSender.send(mmm.getMimeMessage());
    }
    catch (Exception e) {
        LOG.error("sendEmail() - Error sending email.", e);
        throw new RuntimeException(e);
    }
}
项目:opennmszh    文件:JavaSendMailer.java   
/**
 * <p>buildMimeMessage</p>
 *
 * @param msg a {@link org.opennms.netmgt.config.javamail.SendmailMessage} object.
 * @return a {@link org.springframework.mail.javamail.MimeMailMessage} object.
 */
public MimeMailMessage buildMimeMessage(SendmailMessage msg) {
    //no need to set the same object again
    if (m_config.getSendmailMessage() != msg) {
        m_config.setSendmailMessage(msg);
    }
    MimeMailMessage mimeMsg = new MimeMailMessage(new MimeMessage(m_session));
    mimeMsg.setFrom(m_config.getSendmailMessage().getFrom());
    mimeMsg.setTo(m_config.getSendmailMessage().getTo());
    mimeMsg.setSubject(m_config.getSendmailMessage().getSubject());
    return mimeMsg;
}
项目:carmaint    文件:MockMailSender.java   
@Override
public void send(SimpleMailMessage simpleMessage) throws MailException
{
    MimeMailMessage message = new MimeMailMessage(createMimeMessage());
    simpleMessage.copyTo(message);

    final Properties javaMailProperties = getJavaMailProperties();
    javaMailProperties.setProperty("mailContent", simpleMessage.getText());
}
项目:OpenNMS    文件:JavaSendMailer.java   
/**
 * <p>buildMimeMessage</p>
 *
 * @param msg a {@link org.opennms.netmgt.config.javamail.SendmailMessage} object.
 * @return a {@link org.springframework.mail.javamail.MimeMailMessage} object.
 */
public MimeMailMessage buildMimeMessage(SendmailMessage msg) {
    //no need to set the same object again
    if (m_config.getSendmailMessage() != msg) {
        m_config.setSendmailMessage(msg);
    }
    MimeMailMessage mimeMsg = new MimeMailMessage(new MimeMessage(m_session));
    mimeMsg.setFrom(m_config.getSendmailMessage().getFrom());
    mimeMsg.setTo(m_config.getSendmailMessage().getTo());
    mimeMsg.setSubject(m_config.getSendmailMessage().getSubject());
    return mimeMsg;
}
项目:omero-ms-queue    文件:MessageBuilder.java   
private MimeMailMessage mimeBuilder() {
    MimeMessageHelper helper = new MimeMessageHelper(
                                    mailClient.createMimeMessage(),
                                    StandardCharsets.UTF_8.name());
    return new MimeMailMessage(helper);
}
项目:ome-smuggler    文件:MessageBuilder.java   
private MimeMailMessage mimeBuilder() {
    MimeMessageHelper helper = new MimeMessageHelper(
                                    mailClient.createMimeMessage(),
                                    StandardCharsets.UTF_8.name());
    return new MimeMailMessage(helper);
}
项目:opennmszh    文件:JavaSendMailer.java   
/**
 * <p>setMessage</p>
 *
 * @param message a {@link org.springframework.mail.javamail.MimeMailMessage} object.
 */
public void setMessage(MimeMailMessage message) {
    m_message = message;
}
项目:opennmszh    文件:JavaSendMailer.java   
/**
 * <p>getMessage</p>
 *
 * @return a {@link org.springframework.mail.javamail.MimeMailMessage} object.
 */
public MimeMailMessage getMessage() {
    return m_message;
}
项目:OpenNMS    文件:JavaSendMailer.java   
/**
 * <p>setMessage</p>
 *
 * @param message a {@link org.springframework.mail.javamail.MimeMailMessage} object.
 */
public void setMessage(MimeMailMessage message) {
    m_message = message;
}
项目:OpenNMS    文件:JavaSendMailer.java   
/**
 * <p>getMessage</p>
 *
 * @return a {@link org.springframework.mail.javamail.MimeMailMessage} object.
 */
public MimeMailMessage getMessage() {
    return m_message;
}