diff -u --recursive --new-file afd-1.3.6/src/cmdline/asmtp.c afd-1.3.7pre1/src/cmdline/asmtp.c --- afd-1.3.6/src/cmdline/asmtp.c 2007-09-21 15:02:52.000000000 +0200 +++ afd-1.3.7pre1/src/cmdline/asmtp.c 2007-11-30 12:58:32.000000000 +0100 @@ -418,7 +418,7 @@ if (db.from != NULL) { - length = sprintf(buffer, "From: %s\n", db.from); + length = sprintf(buffer, "From: %s\r\n", db.from); if (smtp_write(buffer, NULL, length) < 0) { WHAT_DONE(file_size_done, no_of_files_done); @@ -431,7 +431,7 @@ } if (db.reply_to != NULL) { - length = sprintf(buffer, "Reply-To: %s\n", db.reply_to); + length = sprintf(buffer, "Reply-To: %s\r\n", db.reply_to); if (smtp_write(buffer, NULL, length) < 0) { WHAT_DONE(file_size_done, no_of_files_done); @@ -443,9 +443,20 @@ no_of_bytes += length; } + length = sprintf(buffer, "To: %s\r\n", remote_user); + if (smtp_write(buffer, NULL, length) < 0) + { + WHAT_DONE(file_size_done, no_of_files_done); + trans_log(ERROR_SIGN, __FILE__, __LINE__, NULL, + "Failed to write To header to SMTP-server."); + (void)smtp_quit(); + exit(eval_timeout(WRITE_REMOTE_ERROR)); + } + no_of_bytes += length; + if (db.subject != NULL) { - length = sprintf(buffer, "Subject : %s\r\n", db.subject); + length = sprintf(buffer, "Subject: %s\r\n", db.subject); if (smtp_write(buffer, NULL, length) < 0) { WHAT_DONE(file_size_done, no_of_files_done); @@ -458,7 +469,7 @@ } else if (db.flag & FILE_NAME_IS_SUBJECT) { - length = sprintf(buffer, "Subject : %s\r\n", final_filename); + length = sprintf(buffer, "Subject: %s\r\n", final_filename); if (smtp_write(buffer, NULL, length) < 0) { WHAT_DONE(file_size_done, no_of_files_done); @@ -470,17 +481,6 @@ no_of_bytes += length; } /* if (db.flag & FILE_NAME_IS_SUBJECT) */ - length = sprintf(buffer, "To: %s\r\n", remote_user); - if (smtp_write(buffer, NULL, length) < 0) - { - WHAT_DONE(file_size_done, no_of_files_done); - trans_log(ERROR_SIGN, __FILE__, __LINE__, NULL, - "Failed to write To header to SMTP-server."); - (void)smtp_quit(); - exit(eval_timeout(WRITE_REMOTE_ERROR)); - } - no_of_bytes += length; - /* Send MIME information. */ if (db.flag & ATTACH_FILE) { diff -u --recursive --new-file afd-1.3.6/src/cmdline/init_asmtp.c afd-1.3.7pre1/src/cmdline/init_asmtp.c --- afd-1.3.6/src/cmdline/init_asmtp.c 2007-04-28 08:01:20.000000000 +0200 +++ afd-1.3.7pre1/src/cmdline/init_asmtp.c 2007-11-30 12:36:59.000000000 +0100 @@ -54,14 +54,14 @@ #include "cmdline.h" #include "smtpdefs.h" -/* Global variables */ +/* Global variables. */ extern int sys_log_fd; extern char *p_work_dir; -/* Local global variables */ +/* Local global variables. */ static char name[30]; -/* local functions */ +/* Local function prototypes. */ static void usage(void); @@ -73,7 +73,7 @@ (void)strcpy(name, argv[0]); - /* First initialize all values with default values */ + /* First initialize all values with default values. */ p_db->blocksize = DEFAULT_TRANSFER_BLOCKSIZE; p_db->smtp_server[0] = '\0'; p_db->user[0] = '\0'; @@ -91,7 +91,7 @@ p_db->filename = NULL; p_db->realname = NULL; - /* Evaluate all arguments with '-' */ + /* Evaluate all arguments with '-'. */ while ((--argc > 0) && ((*++argv)[0] == '-')) { switch (*(argv[0] + 1)) @@ -196,7 +196,7 @@ } break; - case 'b' : /* Transfer block size */ + case 'b' : /* Transfer block size. */ if ((argc == 1) || (*(argv + 1)[0] == '-')) { @@ -268,7 +268,7 @@ } break; - case 'h' : /* Remote host name */ + case 'h' : /* Remote host name. */ if ((argc == 1) || (*(argv + 1)[0] == '-')) { @@ -375,7 +375,7 @@ } break; - case 'p' : /* Remote TCP port number */ + case 'p' : /* Remote TCP port number. */ if ((argc == 1) || (*(argv + 1)[0] == '-')) { @@ -487,7 +487,7 @@ usage(); exit(0); - default : /* Unknown parameter */ + default : /* Unknown parameter. */ #ifdef _GERMAN (void)fprintf(stderr, "ERROR : Unbekannter Parameter <%c>. (%s %d)\n", @@ -548,7 +548,7 @@ } } - /* If input is not correct show syntax */ + /* If input is not correct show syntax. */ if (correct == NO) { usage(); @@ -581,7 +581,7 @@ (void)fprintf(stderr, " -m - Mailserver der die Mail verschicken.\n"); (void)fprintf(stderr, " soll. Standard ist %s.\n", SMTP_HOST_NAME); (void)fprintf(stderr, " -n - Dateiname ist das Subject.\n"); - (void)fprintf(stderr, " -o - Wo der Empfaenger seine Antwort schicken\n"); + (void)fprintf(stderr, " -o - Wo der Empfaenger seine Antwort schicken\n"); (void)fprintf(stderr, " soll.\n"); (void)fprintf(stderr, " -p - IP Portnummer des SMTP-Servers.\n"); (void)fprintf(stderr, " Standard %d.\n", DEFAULT_SMTP_PORT); @@ -630,7 +630,7 @@ (void)fprintf(stderr, " -m - Mailserver that will send this mail.\n"); (void)fprintf(stderr, " Default is %s.\n", SMTP_HOST_NAME); (void)fprintf(stderr, " -n - File name is subject.\n"); - (void)fprintf(stderr, " -o - Where the receiver should send is reply.\n"); + (void)fprintf(stderr, " -o - Where the receiver should send is reply.\n"); (void)fprintf(stderr, " -p - Remote port number of SMTP-server.\n"); (void)fprintf(stderr, " Default %d.\n", DEFAULT_SMTP_PORT); (void)fprintf(stderr, " -r - Remove transmitted file.\n");