本文整理汇总了Java中br.org.owail.sender.email.Sender类的典型用法代码示例。如果您正苦于以下问题:Java Sender类的具体用法?Java Sender怎么用?Java Sender使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Sender类属于br.org.owail.sender.email包,在下文中一共展示了Sender类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
@Override
public void create(SignupDataDto signupDataDto) throws EmailNotificationException, DataNotFoundException, AlreadyExistException, ValidationException, EncryptedException {
if (signupDataDto.isValid()) {
if (managementUserService.isUnique(signupDataDto.getEmail())) {
User user = new User();
Equalizer.equalize(signupDataDto, user);
Sender sender = emailNotifierService.getSender();
sendEmailToUser(user, sender);
sendEmailToAdmin(sender, user);
userDao.persist(user);
} else {
throw new AlreadyExistException();
}
} else {
throw new ValidationException();
}
}
示例2: sendSystemInstallationEmail_method_should_send_an_SystemInstallationEmail
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
@Test
public void sendSystemInstallationEmail_method_should_send_an_SystemInstallationEmail() throws Exception {
whenNew(BasicEmailSender.class).withNoArguments().thenReturn(emailSender);
when(emailSender.getPassword()).thenReturn(PASSWORD);
when(initializationData.getEmailSender()).thenReturn(emailSenderDto);
whenNew(Sender.class).withArguments(Mockito.anyString(), Mockito.anyString(), Mockito.anyString()).thenReturn(sender);
mockStatic(Recipient.class);
when(Recipient.createTO(Mockito.anyString(), Mockito.anyString())).thenReturn(recipient);
mockStatic(OtusEmailFactory.class);
when(OtusEmailFactory.createSystemInstallationEmail(sender, recipient)).thenReturn(installationEmail);
service.sendSystemInstallationEmail(initializationData);
verifyStatic();
OtusEmailFactory.createSystemInstallationEmail(sender, recipient);
}
示例3: main
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
public static void main(String[] args) {
Mailer mailer = Mailer.createTLSMailer(new MyCustomSMTPSessionProps());
/* Configure email sender */
mailer.setFrom(new Sender("Sender Name", "account.user", "the_password"));
/* Configure email recipients */
mailer.addRecipient(Recipient.createTO("Recipient TO", "[email protected]")); // main
mailer.addRecipient(Recipient.createCC("Recipient CC", "[email protected]")); // carbon copy
mailer.addRecipient(Recipient.createBCC("Recipient BCC", "[email protected]")); // blind carbon copy
/* Configure the email message */
mailer.setSubject("Simple Gmail Test!");
mailer.setContent("This is the message body.");
try {
mailer.send();
} catch (Exception e) {
System.out.println("Oh no...");
}
}
示例4: main
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
public static void main(String[] args) {
GMailer mailer = GMailer.createTLSMailer();
/* Configure email sender */
mailer.setFrom(new Sender("Sender Name", "gmail.account.user", "the_password"));
/* Configure email recipients */
mailer.addRecipient(Recipient.createTO("Recipient TO", "[email protected]")); // main
mailer.addRecipient(Recipient.createCC("Recipient CC", "[email protected]")); // carbon copy
mailer.addRecipient(Recipient.createBCC("Recipient BCC", "[email protected]")); // blind carbon copy
/* Configure the email message */
mailer.setSubject("Simple Gmail Test!");
mailer.setContent("This is the message body.");
try {
mailer.send();
} catch (Exception e) {
System.out.println("Oh no...");
}
}
示例5: sendSystemInstallationEmail
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
@Override
public void sendSystemInstallationEmail(OtusInitializationConfigDto initializationData) throws EmailNotificationException, EncryptedException {
BasicEmailSender emailSenderDto = new BasicEmailSender();
Equalizer.equalize(initializationData.getEmailSender(), emailSenderDto);
Recipient recipient = Recipient.createTO(initializationData.getUser().getName(), initializationData.getUser().getEmail());
Sender sender = new Sender(emailSenderDto.getName(), emailSenderDto.getEmail(), EncryptorResources.decrypt(emailSenderDto.getPassword()));
SystemInstallationEmail email = OtusEmailFactory.createSystemInstallationEmail(sender, recipient);
sendEmail(email);
}
示例6: getSender
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
@Override
public Sender getSender() throws EncryptedException, DataNotFoundException {
try{
BasicEmailSender emailSender = systemConfigDao.findEmailSender();
return new Sender(emailSender.getName(), emailSender.getEmail(), EncryptorResources.decrypt(emailSender.getPassword()));
}catch (NoResultException e){
throw new DataNotFoundException();
}
}
示例7: getSender_method_should_return_the_system_email_sender
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
@Test
public void getSender_method_should_return_the_system_email_sender() throws EmailNotificationException, EncryptedException, DataNotFoundException {
when(systemConfigDao.findEmailSender()).thenReturn(emailSender);
when(emailSender.getPassword()).thenReturn(PASSWORD);
Object sender = service.getSender();
assertThat(sender, instanceOf(Sender.class));
}
示例8: spy
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
@Ignore // atualização do powerMock para 1.7.3
@Test
public void method_create_with_signupDataDtoValid_and_managementUserServiceUnique_should_verify_evocation_internal_methods()
throws Exception {
when(signupDataDto.isValid()).thenReturn(POSITIVE_ANSWER);
when(managementUserService.isUnique(anyString())).thenReturn(POSITIVE_ANSWER);
mockStatic(Equalizer.class);
sender = spy(new Sender(NAME, EMAIL, PASSWORD));
when(emailNotifierService.getSender()).thenReturn(sender);
when(user.getName()).thenReturn(NAME);
when(user.getEmail()).thenReturn(EMAIL);
mockStatic(Recipient.class);
systemAdministrator = spy(new User());
when(userDao.findAdmin()).thenReturn(systemAdministrator);
when(systemAdministrator.getName()).thenReturn(NAME);
when(systemAdministrator.getEmail()).thenReturn(EMAIL);
mockStatic(OtusEmailFactory.class);
signupServiceBean.create(signupDataDto);
verifyNew(User.class, times(2)).withNoArguments();
verifyStatic(times(1));
Equalizer.equalize(signupDataDto, user);
verify(emailNotifierService).getSender();
verifyPrivate(signupServiceBean).invoke("sendEmailToUser", user, sender);
verifyPrivate(signupServiceBean).invoke("sendEmailToAdmin", sender, user);
verify(userDao).persist(user);
}
示例9: sendWelcomeEmail
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
@Override
public void sendWelcomeEmail(EmailSenderDto emailSenderDto) throws EmailNotificationException {
Sender sender = new Sender(emailSenderDto.getName(), emailSenderDto.getEmail(), EncryptorResources.decrypt(emailSenderDto.getPassword()));
WelcomeNotificationEmail welcomeNotificationEmail = new WelcomeNotificationEmail();
welcomeNotificationEmail.defineRecipient(emailSenderDto.getEmail());
welcomeNotificationEmail.setFrom(sender);
sendEmail(welcomeNotificationEmail);
}
示例10: newSession
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
public static Session newSession(Properties properties, final Sender sender) {
Session session = Session.getInstance(properties, new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(sender.getEmailAddress(), sender.getPassword());
}
});
return session;
}
示例11: createSystemInstallationEmail
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
public static SystemInstallationEmail createSystemInstallationEmail(Sender sender, Recipient recipient) {
SystemInstallationEmail email = new SystemInstallationEmail(sender, recipient);
email.setFrom(sender);
return email;
}
示例12: createNewUserGreetingsEmail
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
public static NewUserGreetingsEmail createNewUserGreetingsEmail(Sender sender, Recipient recipient) {
NewUserGreetingsEmail email = new NewUserGreetingsEmail(recipient);
email.setFrom(sender);
return email;
}
示例13: createNewUserNotificationEmail
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
public static NewUserNotificationEmail createNewUserNotificationEmail(Sender sender, Recipient recipient, User user) {
NewUserNotificationEmail email = new NewUserNotificationEmail(sender, recipient, user);
email.setFrom(sender);
return email;
}
示例14: NewUserNotificationEmail
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
public NewUserNotificationEmail(Sender sender, Recipient recipient, User user) {
buildDataMap(user);
defineSubject();
defineRecipient(recipient.getEmailAddress());
}
示例15: SystemInstallationEmail
import br.org.owail.sender.email.Sender; //导入依赖的package包/类
public SystemInstallationEmail(Sender sender, Recipient recipient) {
buildDataMap();
defineSubject();
defineRecipient(recipient.getEmailAddress());
}