--- job.c.orig 2004-11-05 15:00:59.860115256 -0500 +++ job.c 2004-11-06 20:44:32.771248736 -0500 @@ -199,7 +199,10 @@ /* is this a complete mail address ? (ie. with a "@", not only a username) */ char complete_adr = 0; int i; - + /*used in the Date line */ + time_t t = time(NULL); + char time_str[255]; + if ( mailf == NULL ) die_e("Could not fdopen() mailfd"); @@ -219,24 +222,24 @@ for ( i = 0 ; line->cl_mailto[i] != '\0' ; i++ ) { if ( line->cl_mailto[i] == '@' ) { complete_adr = 1; + fprintf(mailf, "\nFrom: Cron Daemon <%s>, line->cl_mailto"); break; } } if ( ! complete_adr ) fprintf(mailf, "@%s", hostname); - } + fprintf(mailf, "\nFrom: Cron Daemon <%s@%s>",line->cl_mailto, hostname); + } #else hostname[0] = '\0'; #endif /* HAVE_GETHOSTNAME */ - if (subject) - fprintf(mailf, "\nSubject: fcron <%s@%s> %s: %s\n\n", line->cl_file->cf_user, - ( hostname[0] != '\0')? hostname:"?" , subject, line->cl_shell); - else - fprintf(mailf, "\nSubject: fcron <%s@%s> %s\n\n", line->cl_file->cf_user, - ( hostname[0] != '\0')? hostname:"?" , line->cl_shell); - - + fprintf(mailf, "\nSubject: %s", line->cl_shell); + + /*create an rfc-2822 compliant Date line*/ + strftime(time_str, sizeof(time_str), "%a, %d %b %Y %H:%M:%S %z", localtime(&t)); + fprintf(mailf, "\nDate: %s\n\n", time_str); + return mailf; }