當前位置: 首頁>>代碼示例>>Java>>正文


Java Sender類代碼示例

本文整理匯總了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();
    }
}
 
開發者ID:ccem-dev,項目名稱:otus-api,代碼行數:20,代碼來源:SignupServiceBean.java

示例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);
}
 
開發者ID:ccem-dev,項目名稱:otus-api,代碼行數:20,代碼來源:EmailNotifierServiceTest.java

示例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...");
}
   }
 
開發者ID:ccem-dev,項目名稱:owail,代碼行數:22,代碼來源:CustomSending.java

示例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...");
}
   }
 
開發者ID:ccem-dev,項目名稱:owail,代碼行數:22,代碼來源:SimpleGmail.java

示例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);
}
 
開發者ID:ccem-dev,項目名稱:otus-api,代碼行數:10,代碼來源:EmailNotifierServiceBean.java

示例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();
    }
}
 
開發者ID:ccem-dev,項目名稱:otus-api,代碼行數:11,代碼來源:EmailNotifierServiceBean.java

示例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));
}
 
開發者ID:ccem-dev,項目名稱:otus-api,代碼行數:10,代碼來源:EmailNotifierServiceTest.java

示例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);

}
 
開發者ID:ccem-dev,項目名稱:otus-api,代碼行數:31,代碼來源:SignupServiceBeanTest.java

示例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);
}
 
開發者ID:ccem-dev,項目名稱:otus-domain-api,代碼行數:10,代碼來源:EmailNotifierServiceBean.java

示例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;
   }
 
開發者ID:ccem-dev,項目名稱:owail,代碼行數:11,代碼來源:EmailSessionFactory.java

示例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;
}
 
開發者ID:ccem-dev,項目名稱:otus-api,代碼行數:7,代碼來源:OtusEmailFactory.java

示例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;
}
 
開發者ID:ccem-dev,項目名稱:otus-api,代碼行數:7,代碼來源:OtusEmailFactory.java

示例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;
}
 
開發者ID:ccem-dev,項目名稱:otus-api,代碼行數:7,代碼來源:OtusEmailFactory.java

示例14: NewUserNotificationEmail

import br.org.owail.sender.email.Sender; //導入依賴的package包/類
public NewUserNotificationEmail(Sender sender, Recipient recipient, User user) {
    buildDataMap(user);
    defineSubject();
    defineRecipient(recipient.getEmailAddress());
}
 
開發者ID:ccem-dev,項目名稱:otus-api,代碼行數:6,代碼來源:NewUserNotificationEmail.java

示例15: SystemInstallationEmail

import br.org.owail.sender.email.Sender; //導入依賴的package包/類
public SystemInstallationEmail(Sender sender, Recipient recipient) {
    buildDataMap();
    defineSubject();
    defineRecipient(recipient.getEmailAddress());
}
 
開發者ID:ccem-dev,項目名稱:otus-api,代碼行數:6,代碼來源:SystemInstallationEmail.java


注:本文中的br.org.owail.sender.email.Sender類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。