本文整理汇总了Java中org.springframework.mail.javamail.MimeMailMessage类的典型用法代码示例。如果您正苦于以下问题:Java MimeMailMessage类的具体用法?Java MimeMailMessage怎么用?Java MimeMailMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MimeMailMessage类属于org.springframework.mail.javamail包,在下文中一共展示了MimeMailMessage类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: buildMimeMessage
import org.springframework.mail.javamail.MimeMailMessage; //导入依赖的package包/类
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();
}
开发者ID:openmicroscopy,项目名称:omero-ms-queue,代码行数:12,代码来源:MessageBuilder.java
示例2: forward
import org.springframework.mail.javamail.MimeMailMessage; //导入依赖的package包/类
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);
}
开发者ID:ascalo19,项目名称:imap2smtp,代码行数:10,代码来源:JavaMailForwarder.java
示例3: send
import org.springframework.mail.javamail.MimeMailMessage; //导入依赖的package包/类
@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);
}
开发者ID:opendata-euskadi,项目名称:r01fb,代码行数:12,代码来源:JavaMailSenderImplBase.java
示例4: sendEmail
import org.springframework.mail.javamail.MimeMailMessage; //导入依赖的package包/类
/**
* 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);
}
}
开发者ID:kuali,项目名称:kfs,代码行数:44,代码来源:AttachmentMailerImpl.java
示例5: buildMimeMessage
import org.springframework.mail.javamail.MimeMailMessage; //导入依赖的package包/类
/**
* <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;
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:JavaSendMailer.java
示例6: send
import org.springframework.mail.javamail.MimeMailMessage; //导入依赖的package包/类
@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());
}
开发者ID:jeffsheets,项目名称:carmaint,代码行数:10,代码来源:MockMailSender.java
示例7: mimeBuilder
import org.springframework.mail.javamail.MimeMailMessage; //导入依赖的package包/类
private MimeMailMessage mimeBuilder() {
MimeMessageHelper helper = new MimeMessageHelper(
mailClient.createMimeMessage(),
StandardCharsets.UTF_8.name());
return new MimeMailMessage(helper);
}
开发者ID:openmicroscopy,项目名称:omero-ms-queue,代码行数:7,代码来源:MessageBuilder.java
示例8: setMessage
import org.springframework.mail.javamail.MimeMailMessage; //导入依赖的package包/类
/**
* <p>setMessage</p>
*
* @param message a {@link org.springframework.mail.javamail.MimeMailMessage} object.
*/
public void setMessage(MimeMailMessage message) {
m_message = message;
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:9,代码来源:JavaSendMailer.java
示例9: getMessage
import org.springframework.mail.javamail.MimeMailMessage; //导入依赖的package包/类
/**
* <p>getMessage</p>
*
* @return a {@link org.springframework.mail.javamail.MimeMailMessage} object.
*/
public MimeMailMessage getMessage() {
return m_message;
}
开发者ID:qoswork,项目名称:opennmszh,代码行数:9,代码来源:JavaSendMailer.java
注:本文中的org.springframework.mail.javamail.MimeMailMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论