]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/message.c
This commit was manufactured by cvs2svn to create tag
[bacula/bacula] / bacula / src / lib / message.c
index 4aee2447569a4805cacf729726a1dadfb006be2d..edc5e74d93097c5f1cf78297130e6f8e398076a8 100755 (executable)
@@ -372,18 +372,30 @@ static void make_unique_mail_filename(JCR *jcr, POOLMEM **name, DEST *d)
 static BPIPE *open_mail_pipe(JCR *jcr, POOLMEM **cmd, DEST *d)
 {
    BPIPE *bpipe;
-
-   if (d->mail_cmd && jcr) {
+   int use_bsmtp = (d->mail_cmd && jcr);
+       
+   if (use_bsmtp) {
       *cmd = edit_job_codes(jcr, *cmd, d->mail_cmd, d->where);
    } else {
+#if 1
+      Mmsg(cmd, "/usr/lib/sendmail -F Bacula %s", d->where);
+#else
       Mmsg(cmd, "mail -s \"Bacula Message\" %s", d->where);
+#endif
    }
    fflush(stdout);
 
    if (!(bpipe = open_bpipe(*cmd, 120, "rw"))) {
       Jmsg(jcr, M_ERROR, 0, "open mail pipe %s failed: ERR=%s\n", 
         *cmd, strerror(errno));
-   } 
+   }
+
+#if 1
+   if (!use_bsmtp) {
+       fprintf(bpipe->wfd, "Subject: Bacula Message\r\n\r\n");
+   }
+#endif
+   
    return bpipe;
 }