本文整理汇总了Java中org.subethamail.wiser.WiserMessage.getEnvelopeReceiver方法的典型用法代码示例。如果您正苦于以下问题:Java WiserMessage.getEnvelopeReceiver方法的具体用法?Java WiserMessage.getEnvelopeReceiver怎么用?Java WiserMessage.getEnvelopeReceiver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.subethamail.wiser.WiserMessage
的用法示例。
在下文中一共展示了WiserMessage.getEnvelopeReceiver方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEmailUser
import org.subethamail.wiser.WiserMessage; //导入方法依赖的package包/类
@Test
public void testEmailUser() throws Exception {
CallingContext context = ContextFactory.getKernelUser();
AdminApi admin = Kernel.getAdmin();
Map<String, String> map = ImmutableMap.of("msgBody", "Hi", "emailTo", "$user.emailAddress$", "subject", "Test Rapture Password Reset");
Kernel.getSys().writeSystemConfig(context, "CONFIG", "email/template/CREATE_PASSWORD_RESET_TOKEN", JacksonUtil.jsonFromObject(map));
if (!admin.doesUserExist(context, geezer)) {
admin.addUser(context, geezer, "Geezer Butler", MD5Utils.hash16(geezer), "[email protected]");
}
Map<String, Object> tmap = ImmutableMap.of("username", geezer);
Kernel.getAdmin().emailUser(context, geezer, "CREATE_PASSWORD_RESET_TOKEN", tmap);
boolean found = false;
for (WiserMessage message : wiser.getMessages()) {
String envelopeSender = message.getEnvelopeSender();
String envelopeReceiver = message.getEnvelopeReceiver();
MimeMessage mess = message.getMimeMessage();
if (mess.getSubject().equals(map.get("subject"))) {
assertEquals("[email protected]", envelopeSender);
assertEquals("[email protected]", envelopeReceiver);
assertEquals("Hi\r\n", mess.getContent().toString());
found = true;
}
}
assertTrue(found);
}
示例2: testNotificationEmailStep
import org.subethamail.wiser.WiserMessage; //导入方法依赖的package包/类
@Test
public void testNotificationEmailStep() throws MessagingException, IOException {
String workflowUri = "workflow://foo/bar/baz";
Workflow w = new Workflow();
w.setStartStep("step1");
List<Step> steps = new LinkedList<>();
Step step = new Step();
step.setExecutable("dp_java_invocable://notification.steps.NotificationStep");
step.setName("step1");
step.setDescription("description");
steps.add(step);
Map<String, String> viewMap = new HashMap<>();
viewMap.put("NOTIFY_TYPE", "#" + "EMAIL");
viewMap.put("MESSAGE_TEMPLATE", "#" + templateName);
viewMap.put("EMAIL_RECIPIENTS", "#" + "[email protected]");
w.setSteps(steps);
w.setView(viewMap);
w.setWorkflowURI(workflowUri);
Kernel.getDecision().putWorkflow(context, w);
CreateResponse response = Kernel.getDecision().createWorkOrderP(context, workflowUri, null, null);
assertTrue(response.getIsCreated());
WorkOrderDebug debug;
WorkOrderExecutionState state = WorkOrderExecutionState.NEW;
long timeout = System.currentTimeMillis() + 60000;
do {
debug = Kernel.getDecision().getWorkOrderDebug(context, response.getUri());
state = debug.getOrder().getStatus();
} while (((state == WorkOrderExecutionState.NEW) || (state == WorkOrderExecutionState.ACTIVE)) && (System.currentTimeMillis() < timeout));
StepRecord sr = null;
for (WorkerDebug wd : debug.getWorkerDebugs()) {
for (StepRecordDebug srd : wd.getStepRecordDebugs()) {
sr = srd.getStepRecord();
System.out.println(JacksonUtil.formattedJsonFromObject(sr));
}
}
assertNotNull(sr);
assertEquals(sr.toString(), Steps.NEXT.toString(), sr.getRetVal());
assertEquals(WorkOrderExecutionState.FINISHED, debug.getOrder().getStatus());
boolean found = false;
for (WiserMessage message : wiser.getMessages()) {
String envelopeSender = message.getEnvelopeSender();
String envelopeReceiver = message.getEnvelopeReceiver();
MimeMessage mess = message.getMimeMessage();
if (mess.getSubject().equals(("Ignore this message"))) {
assertEquals("[email protected]", envelopeSender);
assertEquals("[email protected]", envelopeReceiver);
assertEquals("This email is generated from NotificationStepTest in WorkflowCommonSteps", mess.getContent().toString().trim());
found = true;
}
}
assertTrue(found);
}
示例3: testOrigin
import org.subethamail.wiser.WiserMessage; //导入方法依赖的package包/类
@Test
public void testOrigin() throws MessagingException, IOException {
if (!admin.doesUserExist(context, geezer)) {
admin.addUser(context, geezer, "Geezer Butler", MD5Utils.hash16(geezer), "[email protected]");
}
SMTPConfig emailCfg = new SMTPConfig().setHost("localhost").setPort(2525).setUsername("").setPassword("")
.setFrom("Incapture <[email protected]>").setAuthentication(false).setTlsenable(false).setTlsrequired(false).setDebug("INFO");
Kernel.getSys().writeSystemConfig(context, configStr, Mailer.SMTP_CONFIG_URL, JacksonUtil.jsonFromObject(emailCfg));
Map<String, String> reset = ImmutableMap.of("emailTo", "$user.emailAddress$", "subject", "Rapture Password Reset", "msgBody",
"<!DOCTYPE html><html style='margin:0; padding:0; font-size: 16px; font-weight: normal;'><head><link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' "
+ "type='text/css'><meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /><meta name='viewport' content='width=device-width, initial-scale=1.0'>"
+ "<title>Rapture Password Reset</title><link href='https://fonts.googleapis.com/css?family=Montserrat|Open+Sans' rel='stylesheet'></head>"
+ "<body style='margin: 0; padding: 0;'><table align='center' border='0' cellpadding='0' cellspacing='0' height='100%' width='100%' id='emailContainer' style='width: 100%;'>"
+ "<tr><td align='center' valign='top' style='width: 100%; max-width: 620px; padding: calc(1.75% + 8px) 0; position: relative; background-image: url(https://s28.postimg.org/eld392gb1/rui_email_bg.png);background-position: center center;'><!-- <center> --><table align='center' border='0' cellpadding='0' cellspacing='0' height='100%' width='100%' id='emailContainer' style='width: 100%;'><tr>"
+ "<div style='text-align: center;'><a href='$origin$' target='_blank' style='text-decoration: none'><img src='https://s28.postimg.org/8vwuora4t/rui_logo.png' alt='Rapture UI Logo' style='text-decoration:none; width: calc(10% + 32px); opacity: .92;' /></a></div></tr><tr>"
+ "<div style='padding-top: 16px; text-align: center;'><a href='$origin$' target='_blank' style='text-decoration: none; color: #a7abb2; line-height: 14px; font-size: 20px; letter-spacing: 8px; margin-left: 8px; width: 100%; font-family: \"Montserrat\", Arial, sans-serif;'>RAPTURE</a></div></tr></table></td></tr><tr><td align='center' valign='top' style='word-break: break-all; background-color: #5d7cae; padding: 32px;'>"
+ "<div style='width: 100%; max-width: 620px; margin:0 auto; text-align: left; font-size: 15px; color: #FFF; font-family: \"Open Sans\", Arial, sans-serif;'>Hello $userFullName$,<br>"
+ "<br>You recently requested your password to be reset. Please click the button below to be linked to our secured server to complete this process. Note that this link is only valid for 24 hours.<br><br><br>"
+ "<div style='text-align: center; padding: 16px 0 18px 0;'><a href='$origin$/signin/update_password/$user.username$/$user.passwordResetToken$' target='_blank' style='text-decoration:none; color: #fff; cursor: pointer; background: #94aedb; position: relative; padding: 16px 24px; border-bottom: 3px solid #7f9ccc; font-family: \"Montserrat\", Arial, sans-serif; font-size: 14px; letter-spacing: 2px; text-indent: 2px;'>"
+ "<span>UPDATE MY PASSWORD</span></a></div><br><br>If you encounter any issues or have questions or believe this email was sent to you by mistake, please contact us at:<br><a style='color: #FFF' href='mailto:[email protected]'>[email protected]</a><br><br><br>Thank you for choosing Rapture,<br>The Incapture Technologies Team</div></td>"
+ "</tr><tr><td align='center' valign='top' style='background-color: #4d6593; padding: 32px; color: #FFF; font-size: 12px; font-family: \"Open Sans\", Arial, sans-serif;'>"
+ "<div style='width: 100%; max-width: 620px; position: relative; text-align: left;'>Incapture Technologies<br>600 Montgomery Street<br>Third Floor<br>San Francisco CA 94111</div><br><br>"
+ "<div style='width: 100%; max-width: 620px; position: relative; text-align: left; height: 60px; line-height: 60px;'>"
+ "<span style='float: right; height: 100%; line-height: 60px;'><img style='width: 140px' src='https://s28.postimg.org/b313coff1/incapture_logo_white.png'/></span>"
+ "<span style='opacity: .75; margin-right: 12px;'><a href='//www.facebook.com/incapture' rel='external' target='_blank'><img style='width: 28px;' src='https://s28.postimg.org/g6sd0vqj1/facebook.png'/></a></span>"
+ "<span style='opacity: .75; margin-right: 12px;'>"
+ "<a href='//www.linkedin.com/company/2748426' rel='external' target='_blank'><img style='width: 28px;' src='https://s28.postimg.org/92ajruj9p/linkedin.png'/></a></span>"
+ "<span style='opacity: .75; margin-right: 12px;'><a href='http://plus.google.com/117139879784498155144' rel='external' target='_blank'><img style='width: 28px;' src='https://s28.postimg.org/w2h746h3h/google_plus.png'/></a></span>"
+ "<span style='opacity: .75; margin-right: 12px;'><a href='https://github.com/RapturePlatform/' rel='external' target='_blank'>"
+ "<img style='width: 28px;' src='https://s28.postimg.org/53dc90uml/github_circle.png'/></a></span></div></td></tr></table></body></html>");
String content = JacksonUtil.jsonFromObject(reset);
Kernel.getSys().writeSystemConfig(context, configStr, "email/template/CREATE_PASSWORD_RESET_TOKEN", content);
Map<String, Object> map = ImmutableMap.of("origin", "'", "userFullName", geezer);
admin.emailUser(context, geezer, "CREATE_PASSWORD_RESET_TOKEN", map);
boolean found = false;
for (WiserMessage message : wiser.getMessages()) {
String envelopeSender = message.getEnvelopeSender();
String envelopeReceiver = message.getEnvelopeReceiver();
MimeMessage mess = message.getMimeMessage();
if (mess.getSubject().equals(reset.get("subject"))) {
assertEquals("[email protected]", envelopeSender);
assertEquals("[email protected]", envelopeReceiver);
assertEquals(reset.get("msgBody").replaceAll(".origin.", map.get("origin").toString()).replaceAll(".userFullName.", geezer)
.replaceAll(".user.username.", geezer).replaceAll(".user.passwordResetToken.", "") + "\r\n",
mess.getContent().toString());
found = true;
}
}
assertTrue(found);
}