export HOME
unset MAILDROP MHBUILD MHCONTEXT MHMTSUSERCONF MHN MHSHOW MHSTORE
-unset MHLDEBUG MHPDEBUG MHWDEBUG PAGER XOAUTH
+unset MHLDEBUG MHPDEBUG MHWDEBUG PAGER XOAUTH SMTPUTF8
#### Set LC_ALL in individual tests as needed. Unset these so
#### that we don't depend on user's settings in other tests.
unset LANG LC_ALL LC_CTYPE
int rc, conn, smtp_state;
FILE *f;
const char *xoauth = getenv("XOAUTH");
+ const char *smtputf8 = getenv("SMTPUTF8");
if (argc != 3) {
fprintf(stderr, "Usage: %s output-filename port\n", argv[0]);
smtp_state = SMTP_DATA;
continue;
}
- if (xoauth == NULL) {
+ if (strncmp(line, "EHLO", 4) == 0) {
putcrlf(conn, "250-ready");
- putcrlf(conn, "250-8BITMIME");
- putcrlf(conn, "250-SMTPUTF8");
- } else {
- /* XOAUTH2 support enabled; handle EHLO and AUTH. */
- if (strncmp(line, "EHLO", 4) == 0) {
- putcrlf(conn, "250-ready");
- putcrlf(conn, "250 AUTH XOAUTH2");
- continue;
+ if (smtputf8 != NULL) {
+ putcrlf(conn, "250-8BITMIME");
+ putcrlf(conn, "250-SMTPUTF8");
+ }
+ if (xoauth != NULL) {
+ putcrlf(conn, "250-AUTH XOAUTH2");
}
+ putcrlf(conn, "250 I'll buy that for a dollar!");
+ continue;
+ }
+ if (xoauth != NULL) {
+ /* XOAUTH2 support enabled; handle AUTH (and EHLO above). */
if (strncmp(line, "AUTH", 4) == 0) {
if (strncmp(line, "AUTH XOAUTH2", 12) == 0
&& strstr(line, xoauth) != NULL) {
setup_test
mhl="${MH_LIBEXEC_DIR}/mhl"
+SMTPUTF8=1; export SMTPUTF8
#### Make sure that html-to-text conversion is what we expect.
require_locale en_US.utf-8 en_US.utf8
test_post "${testname}.actual" "${testname}.expected"
+start_test "smtp server doesn't support SMTPUTF8"
+unset SMTPUTF8
+cat > "${testname}.expected" <<EOF
+EHLO nosuchhost.example.com
+RSET
+QUIT
+EOF
+cat > "${testname}.expected.err" <<EOF
+post: problem initializing server; [BHST] ready; I'll buy that for a dollar!
+send: message not delivered to anyone
+EOF
+mv -f "${MH_TEST_DIR}/Mail/,draft" "${MH_TEST_DIR}/Mail/draft"
+
+set +e
+test_post "${testname}.actual" "${testname}.expected" 2>"${testname}.err"
+set -e
+check "${testname}.err" "${testname}.expected.err"
+
+
finish_test
exit $failed
<= 220 Not really an ESMTP server
=> EHLO nosuchhost.example.com
<= 250-ready
-<= 250-8BITMIME
-<= 250-SMTPUTF8
<= 250 I'll buy that for a dollar!
=> MAIL FROM:<nobody@example.com>
-<= 250-ready
-<= 250-8BITMIME
-<= 250-SMTPUTF8
<= 250 I'll buy that for a dollar!
=> RCPT TO:<somebody@example.com>
-<= 250-ready
-<= 250-8BITMIME
-<= 250-SMTPUTF8
<= 250 I'll buy that for a dollar!
=> DATA
<= 354 Go ahead