本文整理汇总了Java中org.simplejavamail.email.Email类的典型用法代码示例。如果您正苦于以下问题:Java Email类的具体用法?Java Email怎么用?Java Email使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Email类属于org.simplejavamail.email包,在下文中一共展示了Email类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import org.simplejavamail.email.Email; //导入依赖的package包/类
public static void main(final String[] args)
throws Exception {
final EmailPopulatingBuilder emailPopulatingBuilderNormal = EmailBuilder.startingBlank();
emailPopulatingBuilderNormal.from("lollypop", "[email protected]");
// don't forget to add your own address here ->
emailPopulatingBuilderNormal.to("C.Cane", YOUR_GMAIL_ADDRESS);
emailPopulatingBuilderNormal.withPlainText("We should meet up!");
emailPopulatingBuilderNormal.withHTMLText("<b>We should meet up!</b><img src='cid:thumbsup'>");
emailPopulatingBuilderNormal.withSubject("hey");
// add two text files in different ways and a black thumbs up embedded image ->
emailPopulatingBuilderNormal.withAttachment("dresscode.txt", new ByteArrayDataSource("Black Tie Optional", "text/plain"));
emailPopulatingBuilderNormal.withAttachment("location.txt", "On the moon!".getBytes(Charset.defaultCharset()), "text/plain");
String base64String = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABeElEQVRYw2NgoAAYGxu3GxkZ7TY1NZVloDcAWq4MxH+B+D8Qv3FwcOCgtwM6oJaDMTAUXOhmuYqKCjvQ0pdoDrCnmwNMTEwakC0H4u8GBgYC9Ap6DSD+iewAoIPm0ctyLqBlp9F8/x+YE4zpYT8T0LL16JYD8U26+B7oyz4sloPwenpYno3DchCeROsUbwa05A8eB3wB4kqgIxOAuArIng7EW4H4EhC/B+JXQLwDaI4ryZaDSjeg5mt4LCcFXyIn1fdSyXJQVt1OtMWGhoai0OD8T0W8GohZifE1PxD/o7LlsPLiFNAKRrwOABWptLAcqc6QGDAHQEOAYaAc8BNotsJAOgAUAosG1AFA/AtUoY3YEFhKMAvS2AE7iC1+WaG1H6gY3gzE36hUFJ8mqzbU1dUVBBqQBzTgIDQRkWo5qCZdpaenJ0Zx1aytrc0DDB0foIG1oAYKqC0IZK8D4n1AfA6IzwPxXpCFoGoZVEUDaRGGUTAKRgEeAAA2eGJC+ETCiAAAAABJRU5ErkJggg==";
emailPopulatingBuilderNormal.withEmbeddedImage("thumbsup", parseBase64Binary(base64String), "image/png");
// let's try producing and then consuming a MimeMessage ->
Email emailNormal = emailPopulatingBuilderNormal.buildEmail();
final MimeMessage mimeMessage = EmailConverter.emailToMimeMessage(emailNormal);
final Email emailFromMimeMessage = EmailConverter.mimeMessageToEmail(mimeMessage);
// note: the following statements will produce 6 new emails!
sendMail(emailNormal);
sendMail(emailFromMimeMessage); // should produce the exact same result as emailPopulatingBuilderNormal!
}
开发者ID:bbottema,项目名称:simple-java-mail,代码行数:26,代码来源:MailTestDemoApp.java
示例2: executeMailTask
import org.simplejavamail.email.Email; //导入依赖的package包/类
private void executeMailTask(MailTask mailTask) {
log.info("------------------------execute queue task------------------------");
log.info("Send mail task consumed on thread: T{}", Thread.currentThread().getId());
log.info(mailTask.getTitle());
try {
Email email = new EmailBuilder()
.from(mailTask.getSenderName(), mailTask.getFrom())
.to(mailTask.getReceiverName(), mailTask.getTo())
.subject(mailTask.getTitle())
.text(mailTask.getContent())
.build();
mailer.sendMail(email);
} catch (Exception e) {
log.error("send mail error", e);
e.printStackTrace();
}
}
开发者ID:thundernet8,项目名称:Elune,代码行数:23,代码来源:MailMQServiceImpl.java
示例3: getEmailConfirmationMail
import org.simplejavamail.email.Email; //导入依赖的package包/类
public static Email getEmailConfirmationMail(String email, String name, String confirmationCode) {
Email mail = getBaseMail();
mail.addNamedToRecipients(name, email);
mail.setSubject("Willkommen bei Twasi");
mail.setTextHTML("Heyho "+name+",<br />" +
"<br />" +
"das Twasi-Team heißt dich herzlich Willkommen bei Twasi, deinem Chatbot von der Community für die Community!<br />" +
"<br />" +
"Um deine E-Mail Adresse zu bestätigen, klicke auf den folgenden Link: "+ Config.getCatalog().webinterface.self + "/confirm?code=" + confirmationCode +"<br />" +
"<br />" +
"Warum solltest du deine E-Mail Adresse bestätigen? Deine E-Mail Adresse wird für später kommende Features erforderlich sein.<br />" +
"<br />" +
"Ab sofort sammeln wir Statistiken deines Twitchchannels, helfen deinen Zuschauern und dir mit Commands im Chat und halten diesen sauber. <br />" +
"<br />" +
"Aber das ist noch lange nicht alles! Wenn du weitere Features kennenlernen möchtest, solltest du einen Blick in unsere <a href=\"https://twasi.net/docs\" >Dokumentation</a> werfen. Dort findest du auch jederzeit Hilfe!" +
"<br />" +
"Wir wünschen dir viel Spaß beim Einrichten und Nutzen von Twasi!<br />" +
"<br />" +
"Solltest du Fragen oder Anregungen haben erreichst du uns unter den angegebenen Social Media Links oder unter der angegebenen E-Mail Adresse.<br />" +
"<br />" +
"Twasi-Team<br />");
appendFooter(mail);
return mail;
}
开发者ID:Twasi,项目名称:twasi-core,代码行数:27,代码来源:MailTemplates.java
示例4: main
import org.simplejavamail.email.Email; //导入依赖的package包/类
public static void main(final String[] args) throws Exception {
clearConfigProperties();
final Email emailNormal = new Email();
emailNormal.setFromAddress("lollypop", "[email protected]");
// don't forget to add your own address here ->
emailNormal.addRecipient("C.Cane", YOUR_GMAIL_ADDRESS, RecipientType.TO);
emailNormal.setText("We should meet up!");
emailNormal.setTextHTML("<b>We should meet up!</b><img src='cid:thumbsup'>");
emailNormal.setSubject("hey");
// add two text files in different ways and a black thumbs up embedded image ->
emailNormal.addAttachment("dresscode.txt", new ByteArrayDataSource("Black Tie Optional", "text/plain"));
emailNormal.addAttachment("location.txt", "On the moon!".getBytes(Charset.defaultCharset()), "text/plain");
String base64String = "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABeElEQVRYw2NgoAAYGxu3GxkZ7TY1NZVloDcAWq4MxH+B+D8Qv3FwcOCgtwM6oJaDMTAUXOhmuYqKCjvQ0pdoDrCnmwNMTEwakC0H4u8GBgYC9Ap6DSD+iewAoIPm0ctyLqBlp9F8/x+YE4zpYT8T0LL16JYD8U26+B7oyz4sloPwenpYno3DchCeROsUbwa05A8eB3wB4kqgIxOAuArIng7EW4H4EhC/B+JXQLwDaI4ryZaDSjeg5mt4LCcFXyIn1fdSyXJQVt1OtMWGhoai0OD8T0W8GohZifE1PxD/o7LlsPLiFNAKRrwOABWptLAcqc6QGDAHQEOAYaAc8BNotsJAOgAUAosG1AFA/AtUoY3YEFhKMAvS2AE7iC1+WaG1H6gY3gzE36hUFJ8mqzbU1dUVBBqQBzTgIDQRkWo5qCZdpaenJ0Zx1aytrc0DDB0foIG1oAYKqC0IZK8D4n1AfA6IzwPxXpCFoGoZVEUDaRGGUTAKRgEeAAA2eGJC+ETCiAAAAABJRU5ErkJggg==";
emailNormal.addEmbeddedImage("thumbsup", parseBase64Binary(base64String), "image/png");
// let's try producing and then consuming a MimeMessage ->
final MimeMessage mimeMessage = Mailer.produceMimeMessage(emailNormal);
final Email emailFromMimeMessage = new Email(mimeMessage);
// note: the following statements will produce 6 new emails!
sendMail(emailNormal);
sendMail(emailFromMimeMessage); // should produce the exact same result as emailNormal!
}
开发者ID:viydaag,项目名称:dungeonstory-java,代码行数:26,代码来源:MailTestApp.java
示例5: produceMimeMessage
import org.simplejavamail.email.Email; //导入依赖的package包/类
/**
* Creates a new {@link MimeMessage} instance coupled to a specific {@link Session} instance and prepares it in the email structure, so that it
* can be filled and send.
* <p/>
* Fills subject, from,reply-to, content, sent-date, recipients, texts, embedded images, attachments, content and adds all headers.
*
* @param email The email message from which the subject and From-address are extracted.
* @param session The Session to attach the MimeMessage to
* @return A fully preparated {@link Message} instance, ready to be sent.
* @throws MessagingException May be thrown when the message couldn't be processed by JavaMail.
* @throws UnsupportedEncodingException Zie {@link InternetAddress#InternetAddress(String, String)}.
*/
public static MimeMessage produceMimeMessage(final Email email, final Session session)
throws MessagingException, UnsupportedEncodingException {
if (email == null) {
throw new IllegalStateException("email is missing");
}
if (session == null) {
throw new IllegalStateException("session is needed, it cannot be attached later");
}
// create new wrapper for each mail being sent (enable sending multiple emails with one mailer)
final MimeEmailMessageWrapper messageRoot = new MimeEmailMessageWrapper();
final MimeMessage message = new MimeMessage(session);
// set basic email properties
message.setSubject(email.getSubject(), CHARACTER_ENCODING);
message.setFrom(new InternetAddress(email.getFromRecipient().getAddress(), email.getFromRecipient().getName(), CHARACTER_ENCODING));
setReplyTo(email, message);
setRecipients(email, message);
// fill multipart structure
setTexts(email, messageRoot.multipartAlternativeMessages);
setEmbeddedImages(email, messageRoot.multipartRelated);
setAttachments(email, messageRoot.multipartRoot);
message.setContent(messageRoot.multipartRoot);
setHeaders(email, message);
message.setSentDate(new Date());
return message;
}
开发者ID:QianWorks,项目名称:qianworks-meican,代码行数:38,代码来源:Mailer.java
示例6: signMessageWithDKIM
import org.simplejavamail.email.Email; //导入依赖的package包/类
/**
* Primes the {@link MimeMessage} instance for signing with DKIM. The signing itself is performed by {@link DkimMessage} and {@link DkimSigner}
* during the physical sending of the message.
*
* @param message The message to be signed when sent.
* @param email The {@link Email} that contains the relevant signing information
* @return The original mime message wrapped in a new one that performs signing when sent.
*/
static MimeMessage signMessageWithDKIM(final MimeMessage message, final Email email) {
try {
final DkimSigner dkimSigner = new DkimSigner(email.getSigningDomain(), email.getSelector(),
email.getDkimPrivateKeyInputStream());
dkimSigner.setIdentity(email.getFromRecipient().getAddress());
dkimSigner.setHeaderCanonicalization(Canonicalization.SIMPLE);
dkimSigner.setBodyCanonicalization(Canonicalization.RELAXED);
dkimSigner.setSigningAlgorithm(SigningAlgorithm.SHA256_WITH_RSA);
dkimSigner.setLengthParam(true);
dkimSigner.setZParam(false);
return new DkimMessage(message, dkimSigner);
} catch (IOException | NoSuchAlgorithmException | InvalidKeySpecException | MessagingException e) {
throw new MailerException(MailerException.INVALID_DOMAINKEY, e);
}
}
开发者ID:QianWorks,项目名称:qianworks-meican,代码行数:24,代码来源:Mailer.java
示例7: testWriteReportEmptyTestSuites
import org.simplejavamail.email.Email; //导入依赖的package包/类
@Test
public void testWriteReportEmptyTestSuites() throws IOException {
EmailFormatter formatter = mock(EmailFormatter.class);
doCallRealMethod().when(formatter).writeReport(any());
set(formatter, "recipientEmails", Collections.singletonList("[email protected]"));
set(formatter, "senderName", "Validatar");
set(formatter, "fromEmail", "[email protected]");
set(formatter, "replyTo", "[email protected]");
set(formatter, "smtpHost", "host.host.com");
set(formatter, "smtpPort", 25);
doAnswer(iom -> {
Email email = (Email) iom.getArguments()[1];
String html = email.getTextHTML();
assertTrue(html.contains("Nice!"));
return null;
}
).when(formatter).sendEmail(any(), any());
formatter.writeReport(null);
}
开发者ID:yahoo,项目名称:validatar,代码行数:20,代码来源:EmailFormatterTest.java
示例8: assertSendingEmail
import org.simplejavamail.email.Email; //导入依赖的package包/类
private Email assertSendingEmail(final EmailPopulatingBuilder originalEmailPopulatingBuilder)
throws MessagingException {
Email originalEmail = originalEmailPopulatingBuilder.buildEmail();
mailer.sendMail(originalEmail);
MimeMessage receivedMimeMessage = smtpServerRule.getOnlyMessage();
assertThat(receivedMimeMessage.getMessageID()).isEqualTo(originalEmail.getId());
Email receivedEmail = mimeMessageToEmail(receivedMimeMessage);
// hack: it seems Wiser automatically defaults replyTo address to the From address if left empty
if (originalEmailPopulatingBuilder.getReplyToRecipient() == null) {
originalEmailPopulatingBuilder.withReplyTo(originalEmailPopulatingBuilder.getFromRecipient());
}
// received email will always have an id, so let's make sure we're able to compare to the original email object
if (originalEmailPopulatingBuilder.getHeaders().get("Message-ID") == null) {
originalEmailPopulatingBuilder.withHeader("Message-ID", originalEmail.getId());
}
// bounce recipient is not part of the Mimemessage, but the Envelope and is configured on the Session, so just ignore this
if (originalEmailPopulatingBuilder.getBounceToRecipient() != null) {
originalEmailPopulatingBuilder.clearBounceTo();
}
assertThat(receivedEmail).isEqualTo(originalEmailPopulatingBuilder.buildEmail());
return receivedEmail;
}
开发者ID:bbottema,项目名称:simple-java-mail,代码行数:24,代码来源:MailerLiveTest.java
示例9: createMailSession_ReplyToMessage_NotAll_AndCustomReferences
import org.simplejavamail.email.Email; //导入依赖的package包/类
@Test
public void createMailSession_ReplyToMessage_NotAll_AndCustomReferences()
throws IOException, MessagingException {
// send initial mail
mailer.sendMail(readOutlookMessage("test-messages/HTML mail with replyto and attachment and embedded image.msg").buildEmail());
MimeMessage receivedMimeMessage = smtpServerRule.getOnlyMessage();
EmailPopulatingBuilder receivedEmailPopulatingBuilder = mimeMessageToEmailBuilder(receivedMimeMessage);
// send reply to initial mail
Email reply = EmailBuilder
.replyingTo(assertSendingEmail(receivedEmailPopulatingBuilder))
.withHeader("References", "dummy-references")
.from("[email protected]")
.withPlainText("This is the reply")
.buildEmail();
// test received reply to initial mail
mailer.sendMail(reply);
MimeMessage receivedMimeMessageReply1 = smtpServerRule.getOnlyMessage("[email protected]");
Email receivedReply = mimeMessageToEmail(receivedMimeMessageReply1);
EmailAssert.assertThat(receivedReply).hasSubject("Re: hey");
EmailAssert.assertThat(receivedReply).hasOnlyRecipients(new Recipient("lollypop-replyto", "[email protected]", TO));
assertThat(receivedReply.getHeaders()).contains(entry("In-Reply-To", receivedEmailPopulatingBuilder.getId()));
assertThat(receivedReply.getHeaders()).contains(entry("References", "dummy-references"));
}
开发者ID:bbottema,项目名称:simple-java-mail,代码行数:27,代码来源:MailerLiveTest.java
示例10: convert
import org.simplejavamail.email.Email; //导入依赖的package包/类
@Override
public EmailEntity convert(Email email) {
EmailEntity emailEntity = new EmailEntity();
emailEntity.setName(email.getFromRecipient().getName());
emailEntity.setEmail(email.getFromRecipient().getAddress());
emailEntity.setRecipients(recipientConverter.convertList(email.getRecipients()));
emailEntity.setAttachments(attachmentConverter.convertList(email.getAttachments()));
emailEntity.setSubject(email.getSubject());
emailEntity.setContent(email.getTextHTML());
emailEntity.setDate(new Date());
return emailEntity;
}
开发者ID:dopse,项目名称:maildump,代码行数:14,代码来源:EmailConverter.java
示例11: getEmailFromData
import org.simplejavamail.email.Email; //导入依赖的package包/类
private Email getEmailFromData(InputStream data) {
Email email = null;
try {
MimeMessage message = new MimeMessage(getSession(), data);
email = EmailConverter.mimeMessageToEmail(message);
} catch (MessagingException e) {
log.error("Unable to convert in MimeMessage");
}
return email;
}
开发者ID:dopse,项目名称:maildump,代码行数:12,代码来源:MyMessageHandler.java
示例12: addEmail
import org.simplejavamail.email.Email; //导入依赖的package包/类
@Override
@Transactional
public EmailEntity addEmail(Email email) {
EmailEntity emailEntity = emailConverter.convert(email);
return emailDAO.save(emailEntity);
}
开发者ID:dopse,项目名称:maildump,代码行数:8,代码来源:EmailServiceImpl.java
示例13: appendFooter
import org.simplejavamail.email.Email; //导入依赖的package包/类
private static void appendFooter(Email mail) {
mail.setTextHTML(mail.getTextHTML() + "<br /><br />" +
"Twasi.net<br />" +
"Twitch Bot - Statistiken - Tools<br />" +
"https://twasi.net<br />" +
"<br />" +
"Kontakt:<br />" +
"E-Mail: <a href=\"mailto://[email protected]\">[email protected]</a><br />" +
"Twitter: <a href=\"https://twitter.com/TwasiNET\">@TwasiNET</a><br />" +
"<br />" +
"<img src=\"data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAATAAAABCCAYAAADQZoqNAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAACR/SURBVHhe7V0HfFRFGk+oopzY0Ts99Ti5O0EPxDukJCGAohTpJXRBSuhFBAJIlV4VQUghvfdAIHRCCTWhE5QWIBBaICRAAuh33zc7m2w2s5v39r232Zz7//3+v8Du25l5b+b955uZb75xADvssKPMkJdfALfzHkBWbi4yzyTpmvuP8uFBQQH/pR0Eu4DZYYeV8PS33+Bk1g3YdyUTkq5mwk9n0sElNBJq+QfBaz7+UHOdab6L1zQMi4QW4dEwPzUNNly7DtuuXIVk5NFrWZjuTci8lwNPMI8/EuwCZocdGuP09Ruw5tgJaLdpM7zkFwCOPr7gEBQMDpER4BAXCw6xMeAQUwrpGka8PjoKHEJDwcE/EBzW+UF1T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i8kw2/4gjhHBpGjPjvC1k3i61W2wXMDjtUAr1YFIWVNn9n3c+Fi/dy4DxaIr/k5sKKtGPQJjwamqPVVts3kPGvPv5QZY0XOKAQmWIF/J6uew+F6n2/IOgYGQeeJ07Cr5huRk4Oy0s955PyB7uA2WGHFUDiRgtFtG2NziQlPnz8GHILHsN9JP01pu7zAnYd+w0ODZ+osCD0/wS7gNlhhx3lFnYBs8MOO8ot7AJmhx12lFvYBcwOO+wopwD4HzAMUECE/qzbAAAAAElFTkSuQmCC\" /><br />" +
"Diese E-Mail wurde automatisch generiert. Solltest du dich nicht bei Twasi registriert haben kannst du diese ignorieren.");
}
开发者ID:Twasi,项目名称:twasi-core,代码行数:14,代码来源:MailTemplates.java
示例14: validate
import org.simplejavamail.email.Email; //导入依赖的package包/类
/**
* Validates an {@link Email} instance. Validation fails if the subject is missing, content is missing, or no recipients are defined.
*
* @param email The email that needs to be configured correctly.
* @return Always <code>true</code> (throws a {@link MailException} exception if validation fails).
* @throws MailException Is being thrown in any of the above causes.
* @see EmailAddressValidator
*/
@SuppressWarnings({ "SameReturnValue", "WeakerAccess" })
public boolean validate(final Email email)
throws MailException {
if (email.getText() == null && email.getTextHTML() == null) {
throw new MailerException(MailerException.MISSING_CONTENT);
} else if (email.getSubject() == null || email.getSubject().equals("")) {
throw new MailerException(MailerException.MISSING_SUBJECT);
} else if (email.getRecipients().size() == 0) {
throw new MailerException(MailerException.MISSING_RECIPIENT);
} else if (email.getFromRecipient() == null) {
throw new MailerException(MailerException.MISSING_SENDER);
} else if (emailAddressCriteria != null) {
if (!EmailAddressValidator.isValid(email.getFromRecipient().getAddress(), emailAddressCriteria)) {
throw new MailerException(format(MailerException.INVALID_SENDER, email));
}
for (final Recipient recipient : email.getRecipients()) {
if (!EmailAddressValidator.isValid(recipient.getAddress(), emailAddressCriteria)) {
throw new MailerException(format(MailerException.INVALID_RECIPIENT, email));
}
}
if (email.getReplyToRecipient() != null && !EmailAddressValidator
.isValid(email.getReplyToRecipient().getAddress(), emailAddressCriteria)) {
throw new MailerException(format(MailerException.INVALID_REPLYTO, email));
}
}
return true;
}
开发者ID:QianWorks,项目名称:qianworks-meican,代码行数:36,代码来源:Mailer.java
示例15: setReplyTo
import org.simplejavamail.email.Email; //导入依赖的package包/类
/**
* Fills the {@link Message} instance with reply-to address.
*
* @param email The message in which the recipients are defined.
* @param message The javax message that needs to be filled with reply-to address.
* @throws UnsupportedEncodingException See {@link InternetAddress#InternetAddress(String, String)}.
* @throws MessagingException See {@link Message#setReplyTo(Address[])}
*/
private static void setReplyTo(final Email email, final Message message)
throws UnsupportedEncodingException, MessagingException {
final Recipient replyToRecipient = email.getReplyToRecipient();
if (replyToRecipient != null) {
final InternetAddress replyToAddress = new InternetAddress(replyToRecipient.getAddress(), replyToRecipient.getName(),
CHARACTER_ENCODING);
message.setReplyTo(new Address[] { replyToAddress });
}
}
开发者ID:QianWorks,项目名称:qianworks-meican,代码行数:18,代码来源:Mailer.java
示例16: setTexts
import org.simplejavamail.email.Email; //导入依赖的package包/类
/**
* Fills the {@link Message} instance with the content bodies (text and html).
*
* @param email The message in which the content is defined.
* @param multipartAlternativeMessages See {@link MimeMultipart#addBodyPart(BodyPart)}
* @throws MessagingException See {@link BodyPart#setText(String)}, {@link BodyPart#setContent(Object, String)} and {@link
* MimeMultipart#addBodyPart(BodyPart)}.
*/
private static void setTexts(final Email email, final MimeMultipart multipartAlternativeMessages)
throws MessagingException {
if (email.getText() != null) {
final MimeBodyPart messagePart = new MimeBodyPart();
messagePart.setText(email.getText(), CHARACTER_ENCODING);
multipartAlternativeMessages.addBodyPart(messagePart);
}
if (email.getTextHTML() != null) {
final MimeBodyPart messagePartHTML = new MimeBodyPart();
messagePartHTML.setContent(email.getTextHTML(), "text/html; charset=\"" + CHARACTER_ENCODING + "\"");
multipartAlternativeMessages.addBodyPart(messagePartHTML);
}
}
开发者ID:QianWorks,项目名称:qianworks-meican,代码行数:22,代码来源:Mailer.java
示例17: setup
import org.simplejavamail.email.Email; //导入依赖的package包/类
@Deprecated
protected void setup(Email email){
if(null!=email){
synchronized (email){
if(null!=email){
email.setFromAddress(nickname, from);
}
}
}
}
开发者ID:QianWorks,项目名称:qianworks-meican,代码行数:11,代码来源:MailService.java
示例18: send
import org.simplejavamail.email.Email; //导入依赖的package包/类
public synchronized void send(String to,String subject,String content){
Email email = new Email();
email.addRecipient(getNickname(to), to, Message.RecipientType.TO);
email.setSubject(subject);
email.setTextHTML(content);
sendMail(email);
}
开发者ID:QianWorks,项目名称:qianworks-meican,代码行数:8,代码来源:MailService.java
示例19: writeReport
import org.simplejavamail.email.Email; //导入依赖的package包/类
/**
* {@inheritDoc}
* <p>
* Render the report HTML using Jtwig and send the result to the recipient emails.
*/
@Override
public void writeReport(List<TestSuite> testSuites) throws IOException {
if (testSuites == null) {
testSuites = Collections.emptyList();
}
log.info("Sending report email for {} test suites", testSuites.size());
List<TestSuiteModel> testList = new ArrayList<>(testSuites.size());
boolean hasError = false;
for (TestSuite testSuite : testSuites) {
TestSuiteModel testSuiteModel = new TestSuiteModel(testSuite);
hasError = hasError || !testSuiteModel.allPassed();
testList.add(testSuiteModel);
}
JtwigTemplate template = JtwigTemplate.classpathTemplate("templates/email.twig");
JtwigModel model = JtwigModel.newModel()
.with("error", hasError)
.with("testList", testList);
String reportHtml = template.render(model);
EmailBuilder emailBuilder = new EmailBuilder().from(senderName, fromEmail)
.replyTo(senderName, replyTo)
.subject("Validatar Report – " + (hasError ? "Test Errors" : "Tests Passed"))
.addHeader("X-Priority", 2)
.textHTML(reportHtml);
for (String recipientEmail : recipientEmails) {
emailBuilder.to(recipientEmail);
}
Email reportEmail = emailBuilder.build();
ServerConfig mailServerConfig = new ServerConfig(smtpHost, smtpPort);
Mailer reportMailer = new Mailer(mailServerConfig, TransportStrategy.SMTP_TLS);
sendEmail(reportMailer, reportEmail);
log.info("Finished sending report to recipients");
}
开发者ID:yahoo,项目名称:validatar,代码行数:38,代码来源:EmailFormatter.java
示例20: testSendEmail
import org.simplejavamail.email.Email; //导入依赖的package包/类
@Test
public void testSendEmail() {
Mailer mailer = mock(Mailer.class);
Email email = mock(Email.class);
EmailFormatter formatter = new EmailFormatter();
formatter.sendEmail(mailer, email);
verify(mailer).sendMail(email);
}
开发者ID:yahoo,项目名称:validatar,代码行数:9,代码来源:EmailFormatterTest.java
注:本文中的org.simplejavamail.email.Email类示例整理自Github/MSDocs等源码及文档管理 |
请发表评论