@Ignore( "TODO: Provide a mocked mail sink " ) @Test public void testSendMail() throws Throwable { Email email = new SimpleEmail(); email.addTo( "heri@lamp.vm" ); email.setSubject( "Testmail" ); email.setMsg( "Dies ist ein Testmail" ); myLog.debug( "Test: sending simple mail: " + email ); myClassUnderTest.sendMail( email ); }
@Override public void sendMail( Email aMail ) throws SdiException { aMail.setHostName( myHost ); if ( mySslOnConnect ) { aMail.setSslSmtpPort( "" + myPort ); } else { aMail.setSmtpPort( myPort ); } aMail.setAuthenticator( myAuthenticator ); aMail.setSSLOnConnect( mySslOnConnect ); aMail.setStartTLSRequired( myStartTlsRequired ); try { aMail.setFrom( mySenderAddress ); } catch ( EmailException t ) { throw new SdiException( "Problems setting the sender address to mail: " + mySenderAddress, t, SdiException.EXIT_CODE_MAIL_ERROR ); } if ( myDryRun ) { myLog.debug( "DryRun is set. Not sending the mail" ); } else { try { aMail.send(); myLog.debug( "mail successfully sent" ); } catch ( Throwable t ) { throw new SdiException( "Problems sending a mail", t, SdiException.EXIT_CODE_MAIL_ERROR ); } } }
MailSenderDefault implements MailSender<Email> { @Override public void sendMail( Email aMail ) throws SdiException { aMail.setHostName( myHost ); if ( mySslOnConnect ) { aMail.setSslSmtpPort( "" + myPort ); } else { aMail.setSmtpPort( myPort ); } aMail.setAuthenticator( myAuthenticator ); aMail.setSSLOnConnect( mySslOnConnect ); aMail.setStartTLSRequired( myStartTlsRequired ); try { aMail.setFrom( mySenderAddress ); } catch ( EmailException t ) { throw new SdiException( "Problems setting the sender address to mail: " + mySenderAddress, t, SdiException.EXIT_CODE_MAIL_ERROR ); } if ( myDryRun ) { myLog.debug( "DryRun is set. Not sending the mail" ); } else { try { aMail.send(); myLog.debug( "mail successfully sent" ); } catch ( Throwable t ) { throw new SdiException( "Problems sending a mail", t, SdiException.EXIT_CODE_MAIL_ERROR ); } } } }
MailSenderDefault implements MailSender<Email> { @Override public void sendMail( Email aMail ) throws SdiException { aMail.setHostName( myHost ); if ( mySslOnConnect ) { aMail.setSslSmtpPort( "" + myPort ); } else { aMail.setSmtpPort( myPort ); } aMail.setAuthenticator( myAuthenticator ); aMail.setSSLOnConnect( mySslOnConnect ); aMail.setStartTLSRequired( myStartTlsRequired ); try { aMail.setFrom( mySenderAddress ); } catch ( EmailException t ) { throw new SdiException( "Problems setting the sender address to mail: " + mySenderAddress, t, SdiException.EXIT_CODE_MAIL_ERROR ); } if ( myDryRun ) { myLog.debug( "DryRun is set. Not sending the mail" ); } else { try { aMail.send(); myLog.debug( "mail successfully sent" ); } catch ( Throwable t ) { throw new SdiException( "Problems sending a mail", t, SdiException.EXIT_CODE_MAIL_ERROR ); } } }  }
MailSenderDefault implements MailSender<Email> { @Override public void sendMail( Email aMail ) throws SdiException { aMail.setHostName( myHost ); if ( mySslOnConnect ) { aMail.setSslSmtpPort( "" + myPort ); } else { aMail.setSmtpPort( myPort ); } aMail.setAuthenticator( myAuthenticator ); aMail.setSSLOnConnect( mySslOnConnect ); aMail.setStartTLSRequired( myStartTlsRequired ); try { aMail.setFrom( mySenderAddress ); } catch ( EmailException t ) { throw new SdiException( "Problems setting the sender address to mail: " + mySenderAddress, t, SdiException.EXIT_CODE_MAIL_ERROR ); } if ( myDryRun ) { myLog.debug( "DryRun is set. Not sending the mail" ); } else { try { aMail.send(); myLog.debug( "mail successfully sent" ); } catch ( Throwable t ) { throw new SdiException( "Problems sending a mail", t, SdiException.EXIT_CODE_MAIL_ERROR ); } } }  @Override void sendMail( Email aMail ); void init(); }
MailSenderDefault implements MailSender<Email> { @Override public void sendMail( Email aMail ) throws SdiException { aMail.setHostName( myHost ); if ( mySslOnConnect ) { aMail.setSslSmtpPort( "" + myPort ); } else { aMail.setSmtpPort( myPort ); } aMail.setAuthenticator( myAuthenticator ); aMail.setSSLOnConnect( mySslOnConnect ); aMail.setStartTLSRequired( myStartTlsRequired ); try { aMail.setFrom( mySenderAddress ); } catch ( EmailException t ) { throw new SdiException( "Problems setting the sender address to mail: " + mySenderAddress, t, SdiException.EXIT_CODE_MAIL_ERROR ); } if ( myDryRun ) { myLog.debug( "DryRun is set. Not sending the mail" ); } else { try { aMail.send(); myLog.debug( "mail successfully sent" ); } catch ( Throwable t ) { throw new SdiException( "Problems sending a mail", t, SdiException.EXIT_CODE_MAIL_ERROR ); } } }  @Override void sendMail( Email aMail ); void init();  }