changeset 119:1e2fd87d58ea

some annotations related to mail sending with SMTP SIZE
author meillo@marmaro.de
date Thu, 01 Jul 2010 13:11:38 +0200 (2010-07-01)
parents 7f1f364c2a29
children cd59a5b4d3dd
files src/smtp_out.c src/smtp_out.h
diffstat 2 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/smtp_out.c	Thu Jul 01 13:09:40 2010 +0200
+++ b/src/smtp_out.c	Thu Jul 01 13:11:38 2010 +0200
@@ -363,10 +363,12 @@
 	ptr = data;
 	while (*ptr) {
 		int c = (int) (*ptr);
-		if (c == '.')
-			if (new_line)
-				putc('.', psb->out);
+		if (c == '.' && new_line) {
+			/* dot-stuffing */
+			putc('.', psb->out);
+		}
 		if (c == '\n') {
+			/* CRLF line terminators */
 			putc('\r', psb->out);
 			putc('\n', psb->out);
 			new_line = TRUE;
@@ -722,7 +724,9 @@
 	}
 
 	if (ok) {
-		smtp_cmd_mailfrom(psb, return_path, psb->use_size ? size + SMTP_SIZE_ADD : 0);
+		/* pretend the message is a bit larger,
+		   just in case the size calculation is buggy */
+		smtp_cmd_mailfrom(psb, return_path, psb->use_size ? size+SMTP_SIZE_ADD : 0);
 
 		if (!psb->use_pipelining) {
 			if ((ok = read_response(psb, SMTP_CMD_TIMEOUT)))
--- a/src/smtp_out.h	Thu Jul 01 13:09:40 2010 +0200
+++ b/src/smtp_out.h	Thu Jul 01 13:11:38 2010 +0200
@@ -23,7 +23,7 @@
 #include <netdb.h>
 
 #define SMTP_BUF_LEN 1024
-#define SMTP_SIZE_ADD 1024
+#define SMTP_SIZE_ADD 1024  /* add to the size of a message */
 
 #define SMTP_INITIAL_TIMEOUT 5*60
 #define SMTP_CMD_TIMEOUT 5*60