ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Alexey Morozov <alex-altlinux@idisys.iae.nsk.su>
To: community@altlinux.ru
Subject: Re: [Comm] помогите наладить модемную почту
Date: Fri, 5 Dec 2003 17:05:26 +0600
Message-ID: <20031205110526.GE11434@pyro.hopawar.private.net> (raw)
In-Reply-To: <20031204190411.GA22392@localhost.localdomain>


[-- Attachment #1.1: Type: text/plain, Size: 358 bytes --]

On Fri, Dec 05, 2003 at 01:04:11AM +0600, Alexey Morozov wrote:
> Поэтому, собственно, я и хочу добиться требуемой мне функциональности от
> msmtp + что-нибудь. В msmtp, на самом деле, подправить нужно не так много.
> Нужно, собственно, разделять коды ошибок на фатальные и нет.
Патч в аттачменте. Проверять еще не проверял, но "должно работать" (TM)
:-))



[-- Attachment #1.2: msmtp-0.6.2-alt-status.patch --]
[-- Type: text/plain, Size: 3421 bytes --]

diff -urN msmtp-0.6.2.orig/src/esmtp.c msmtp-0.6.2/src/esmtp.c
--- msmtp-0.6.2.orig/src/esmtp.c	2003-11-14 00:06:10 +0600
+++ msmtp-0.6.2/src/esmtp.c	2003-12-05 14:26:35 +0600
@@ -862,7 +862,7 @@
     if ((fd = open_socket(server, port)) < 0)
     {
 	add_error_line("cannot connect to SMTP server");
-	error_code = EX_UNAVAILABLE;
+	error_code = EX_TEMPFAIL;
 	goto exit;
     }
     /* start TLS encryption for TLS-only servers (no STARTTLS) if wanted */
@@ -879,7 +879,7 @@
     if (smtp_get_response(fd, &tls, 220) != 220)
     {
 	add_error_line("cannot get initial ok message from SMTP server");
-	error_code = EX_UNAVAILABLE;
+	error_code = EX_TEMPFAIL;
 	goto close_exit;
     }
     /* start smtp session */
@@ -919,11 +919,29 @@
 	error_code = EX_IOERR;
 	goto close_exit;
     }
-    if (smtp_get_response(fd, &tls, 250) != 250)
+    if ((error_code = smtp_get_response(fd, &tls, 250)) != 250)
     {
 	add_error_line("line `MAIL FROM:<%s>' not accepted by SMTP server", 
 		from);
-	error_code = EX_DATAERR;
+	switch (error_code) {
+	case 451:
+	case 452:
+		error_code = EX_TEMPFAIL;
+		break;
+	case 503:
+		error_code = EX_SOFTWARE;
+		break;
+	case 550:
+		error_code = EX_NOPERM;
+		break;
+	case 552:
+	case 553:
+		error_code = EX_UNAVAILABLE;
+		break;
+	default:
+		error_code = EX_PROTOCOL;
+		break;
+	}
 	goto close_exit;
     }
     for (i = 0; i < rcptc; i++)
@@ -933,11 +951,35 @@
 	    error_code = EX_IOERR;
 	    goto close_exit;
 	}
-	if (smtp_get_response(fd, &tls, 250) != 250)
+	if ((error_code = smtp_get_response(fd, &tls, 250)) != 250)
 	{
+	    switch (error_code) {
+	    case 251: // not actually an error
+		continue;
+	    case 450:
+	    case 451:
+	    case 452:
+		error_code = EX_TEMPFAIL;
+		break;
+	    case 503:
+		error_code = EX_SOFTWARE;
+		break;
+	    case 550:
+		error_code = EX_NOPERM;
+		break;
+	    case 551:
+		error_code = EX_NOUSER;
+		break;
+	    case 552:
+	    case 553:
+		error_code = EX_UNAVAILABLE;
+		break;
+	    default:
+		error_code = EX_PROTOCOL;
+		break;
+	    }
 	    add_error_line("line `RCPT TO:<%s>' not accepted by SMTP server", 
 		    rcptv[i]);
-	    error_code = EX_DATAERR;
 	    goto close_exit;
 	}
     }
@@ -947,10 +989,23 @@
 	error_code = EX_IOERR;
 	goto close_exit;
     }
-    if (smtp_get_response(fd, &tls, 354) != 354)
+    if ((error_code = smtp_get_response(fd, &tls, 354)) != 354)
     {
+	switch (error_code) {
+	case 451:
+	    error_code = EX_TEMPFAIL;
+	    break;
+	case 503:
+	    error_code = EX_SOFTWARE;
+	    break;
+	case 554:
+	    error_code = EX_DATAERR;
+	    break;
+	default:
+	    error_code = EX_PROTOCOL;
+	    break;
+	}
 	add_error_line("SMTP server does not accept the mail");
-	error_code = EX_DATAERR;
 	goto close_exit;
     }
     /* Copy the mail from mailf to fd, converting '\n' to '\r\n' and a leading
@@ -1029,10 +1084,24 @@
 	error_code = EX_IOERR;
 	goto close_exit;
     }
-    if (smtp_get_response(fd, &tls, 250) != 250)
+    if ((error_code = smtp_get_response(fd, &tls, 250)) != 250)
     {
+	switch (error_code) {
+	case 451:
+	case 452:
+	    error_code = EX_TEMPFAIL;
+	    break;
+	case 552:
+	    error_code = EX_UNAVAILABLE;
+	    break;
+	case 554:
+	    error_code = EX_DATAERR;
+	    break;
+	default:
+	    error_code = EX_PROTOCOL;
+	    break;
+	}
 	add_error_line("SMTP server did not accept the mail");
-	error_code = EX_DATAERR;
 	goto close_exit;
     }
     

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2003-12-05 11:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-12-01 17:35 sergey ivanov
2003-12-01 17:42 ` Maxim Tyurin
2003-12-01 20:33   ` sergey ivanov
2003-12-02  4:24     ` Bezukladnikov Oleg
2003-12-02  6:40     ` Alexey Morozov
2003-12-03 16:46       ` seriv
2003-12-03 22:09         ` Alexey Morozov
2003-12-04 16:48           ` seriv
2003-12-04 19:04             ` Alexey Morozov
2003-12-05 11:05               ` Alexey Morozov [this message]
2003-12-08 20:33                 ` Ivanov
2003-12-09  5:59                   ` Alexey Morozov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031205110526.GE11434@pyro.hopawar.private.net \
    --to=alex-altlinux@idisys.iae.nsk.su \
    --cc=community@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git