Minor fix
* mail/send.c (mail_send0): Pipe message to the program if the value of sendmail variable begins with a slash. Otherwise, issue meaningful error messages if the mailer cannot be created or opened.
Showing
1 changed file
with
28 additions
and
18 deletions
... | @@ -594,30 +594,40 @@ mail_send0 (compose_env_t * env, int save_to) | ... | @@ -594,30 +594,40 @@ mail_send0 (compose_env_t * env, int save_to) |
594 | || compose_header_get (env, MU_HEADER_BCC, NULL)) | 594 | || compose_header_get (env, MU_HEADER_BCC, NULL)) |
595 | { | 595 | { |
596 | char *sendmail; | 596 | char *sendmail; |
597 | if (mailvar_get (&sendmail, "sendmail", mailvar_type_string, 0) | 597 | if (mailvar_get (&sendmail, "sendmail", |
598 | == 0) | 598 | mailvar_type_string, 0) == 0) |
599 | { | 599 | { |
600 | int status = mu_mailer_create (&mailer, sendmail); | 600 | if (sendmail[0] == '/') |
601 | if (status == 0) | 601 | msg_to_pipe (sendmail, msg); |
602 | else | ||
602 | { | 603 | { |
603 | if (mailvar_get (NULL, "verbose", mailvar_type_boolean, 0) | 604 | int status = mu_mailer_create (&mailer, sendmail); |
604 | == 0) | ||
605 | { | ||
606 | mu_debug_t debug = NULL; | ||
607 | mu_mailer_get_debug (mailer, &debug); | ||
608 | mu_debug_set_level (debug, | ||
609 | MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT)); | ||
610 | } | ||
611 | status = mu_mailer_open (mailer, MU_STREAM_RDWR); | ||
612 | if (status == 0) | 605 | if (status == 0) |
613 | { | 606 | { |
614 | mu_mailer_send_message (mailer, msg, NULL, NULL); | 607 | if (mailvar_get (NULL, "verbose", |
615 | mu_mailer_close (mailer); | 608 | mailvar_type_boolean, 0) == 0) |
609 | { | ||
610 | mu_debug_t debug = NULL; | ||
611 | mu_mailer_get_debug (mailer, &debug); | ||
612 | mu_debug_set_level (debug, | ||
613 | MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT)); | ||
614 | } | ||
615 | status = mu_mailer_open (mailer, MU_STREAM_RDWR); | ||
616 | if (status == 0) | ||
617 | { | ||
618 | mu_mailer_send_message (mailer, msg, | ||
619 | NULL, NULL); | ||
620 | mu_mailer_close (mailer); | ||
621 | } | ||
622 | else | ||
623 | util_error (_("Cannot open mailer: %s"), | ||
624 | mu_strerror (status)); | ||
625 | mu_mailer_destroy (&mailer); | ||
616 | } | 626 | } |
617 | mu_mailer_destroy (&mailer); | 627 | else |
628 | util_error (_("Cannot create mailer: %s"), | ||
629 | mu_strerror (status)); | ||
618 | } | 630 | } |
619 | if (status != 0) | ||
620 | msg_to_pipe (sendmail, msg); | ||
621 | } | 631 | } |
622 | else | 632 | else |
623 | util_error (_("Variable sendmail not set: no mailer")); | 633 | util_error (_("Variable sendmail not set: no mailer")); | ... | ... |
-
Please register or sign in to post a comment