This patch changes Qremote to be a bit more tolerant about the greeting of the remote server. RfC 2821, section 4.2 specifies that a greeting begins with "220 ", so multiline greetings are forbidden. Nevertheless there are some hosts doing this, normally Qremote will refuse to send a mail to them. Index: qremote/qremote.c =================================================================== --- qremote/qremote.c (revision 538) +++ qremote/qremote.c (working copy) @@ -423,13 +423,36 @@ /* for all MX entries we got: try to enable connection, check if the SMTP server wants us * (sends 220 response) and EHLO/HELO succeeds. If not, try next. If none left, exit. */ do { + int flagerr = 0; + tryconn(mx); dup2(socketd, 0); if (netget() != 220) { quitmsg(); continue; } - if (linein[3] != ' ') { + while (!strncmp("220-", linein, 4)) { + if (net_read()) { + flagerr = 1; + switch (errno) { + case ENOMEM: err_mem(1); + case EINVAL: + case E2BIG: (void) write(1, "Zsyntax error in server reply\n", 31); + quitmsg(); + default: { + char *tmp = strerror(errno); + + write(1, "Z", 1); + write(1, tmp, strlen(tmp) + 1); + quitmsg(); + } + } + } + } + if (flagerr) + continue; + + if (strncmp("220 ", linein, 4)) { const char *dropmsg[] = {"invalid greeting from ", NULL, NULL}; getrhost(mx);