- SmtpConversationMock conversat = new SmtpConversationMock(TYPICAL_INIT, TYPICAL);
- SendMailMock smm = new SendMailMock(conversat);
-
- smm.setFrom("tarzan@jane.net");
- smm.addTo("jane@jane.net");
- smm.setSubject("Me Tarzan, you Jane");
-
- MimePart part = new MimePart("text/plain", "Tarzan like Jane\nTarzan come see Jane soon\n\nTarzan");
- smm.addPart(part);
-
- smm.send();
-
- OutputStreamMock osm = conversat.getOutputStream();
- String result = osm.mock_getContent(Charset.forName(FileMock.UTF_8));
-
- int pos = result.indexOf("\r\n");
- assertTrue(pos > 0);
- String afterHELO = result.substring(pos + 2);
+ // Try sending a plain-text email
+ {
+ SmtpConversationMock conversat = new SmtpConversationMock(TYPICAL_INIT, TYPICAL);
+ SendMailMock smm = new SendMailMock(conversat);
+
+ smm.setFrom("tarzan@jane.net");
+ smm.addTo("jane@jane.net");
+ smm.setSubject("Me Tarzan, you Jane");
+
+ MimePart part = new MimePart("text/plain", "Tarzan like Jane\nTarzan come see Jane soon\n\nTarzan");
+ smm.addPart(part);
+
+ smm.send();
+
+ OutputStreamMock osm = conversat.getOutputStream();
+ String result = osm.mock_getContent(Charset.forName(FileMock.UTF_8));
+
+ int pos = result.indexOf("\r\n");
+ assertTrue(pos > 0);
+ String afterHELO = result.substring(pos + 2);
+
+ assertTrue(result.startsWith("HELO "));
+ assertEquals(TYPICAL_SENT, afterHELO);
+ }