public HtmlEmail createEmail(T report) throws MalformedURLException, EmailException {
    HtmlEmail email = new HtmlEmail();

    setEmailSettings(email);
    addReportContent(email, report);

    return email;
  }
@Test
  public void support_starttls() throws Exception {
    BasicEmail basicEmail = new BasicEmail(Set.of("noreply@nowhere"));
    when(emailSettings.getSecureConnection()).thenReturn("STARTTLS");
    when(emailSettings.getSmtpHost()).thenReturn("smtphost");
    when(emailSettings.getSmtpPort()).thenReturn(587);
    when(emailSettings.getFrom()).thenReturn("noreply@nowhere");
    when(emailSettings.getSmtpUsername()).thenReturn("login");
    when(emailSettings.getSmtpPassword()).thenReturn("pwd");

    MultiPartEmail email = sender.createEmail(basicEmail);

    assertThat(email.isSSLOnConnect()).isFalse();
    assertThat(email.isStartTLSEnabled()).isTrue();
    assertThat(email.isStartTLSRequired()).isTrue();
    assertThat(email.getHostName()).isEqualTo("smtphost");
    assertThat(email.getSmtpPort()).isEqualTo("587");
  }