File vixie-cron-4.1-sendasuser.diff of Package cron
Index: config.h
===================================================================
--- config.h.orig
+++ config.h
@@ -65,6 +65,11 @@
* generate the Date: header.
*/
+#define MAIL_FROMUSER /*-*/
+ /* use this if you want all cron-job e-mail to come
+ * from the executing user rather than from "root".
+ */
+
/* if you want to use syslog(3) instead of appending
* to CRONDIR/LOG_FILE (/var/cron/log, e.g.), define
* SYSLOG here. Note that quite a bit of logging
Index: do_command.c
===================================================================
--- do_command.c.orig
+++ do_command.c
@@ -479,7 +479,11 @@ child_process(entry *e, user *u) {
perror(mailcmd);
(void) _exit(ERROR_EXIT);
}
+#ifdef MAIL_FROMUSER
+ fprintf(mail, "From: %s\n", usernm);
+#else
fprintf(mail, "From: root (Cron Daemon)\n");
+#endif
fprintf(mail, "To: %s\n", mailto);
fprintf(mail, "Subject: Cron <%s@%s> %s\n",
usernm, first_word(hostname, "."),