// ====================================================================
this.getMailServer();
String strSubject = "Test HTML Send #1 Subject (w charset)";
this.email = new MockHtmlEmailConcrete();
this.email.setHostName(this.strTestMailServer);
this.email.setSmtpPort(this.getMailServerPort());
this.email.setFrom(this.strTestMailFrom);
this.email.addTo(this.strTestMailTo);
/** File to used to test file attachmetns (Must be valid) */
attachment.setName("Test Attachment");
attachment.setDescription("Test Attachment Desc");
attachment.setPath(testFile.getAbsolutePath());
this.email.attach(attachment);
this.email.setAuthentication(this.strTestUser, this.strTestPasswd);
this.email.setCharset(EmailConstants.ISO_8859_1);
this.email.setSubject(strSubject);
final URL url = new URL(EmailConfiguration.TEST_URL);
final String cid = this.email.embed(url, "Apache Logo");
final String strHtmlMsg =
"<html>The Apache logo - <img src=\"cid:" + cid + "\"><html>";
this.email.setHtmlMsg(strHtmlMsg);
this.email.setTextMsg(
"Your email client does not support HTML emails");
this.email.send();
this.fakeMailServer.stop();
// validate txt message
validateSend(
this.fakeMailServer,
strSubject,
this.email.getTextMsg(),
this.email.getFromAddress(),
this.email.getToAddresses(),
this.email.getCcAddresses(),
this.email.getBccAddresses(),
true);
// validate html message
validateSend(
this.fakeMailServer,
strSubject,
this.email.getHtmlMsg(),
this.email.getFromAddress(),
this.email.getToAddresses(),
this.email.getCcAddresses(),
this.email.getBccAddresses(),
false);
// validate attachment
validateSend(
this.fakeMailServer,
strSubject,
attachment.getName(),
this.email.getFromAddress(),
this.email.getToAddresses(),
this.email.getCcAddresses(),
this.email.getBccAddresses(),
false);
this.getMailServer();
this.email = new MockHtmlEmailConcrete();
this.email.setHostName(this.strTestMailServer);
this.email.setSmtpPort(this.getMailServerPort());
this.email.setFrom(this.strTestMailFrom);
this.email.addTo(this.strTestMailTo);