This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU Mailutils".
http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=b9f10525a3fb6167b0588c988f0aec4507c2c0f0 The branch, master has been updated via b9f10525a3fb6167b0588c988f0aec4507c2c0f0 (commit) from 83f7cbe72032cf88b24039fee63efb44e79c18de (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b9f10525a3fb6167b0588c988f0aec4507c2c0f0 Author: Sergey Poznyakoff <g...@gnu.org.ua> Date: Tue Aug 7 13:02:41 2012 +0300 mail: provide a way to set return address. * mail/mail.c: New option -r (--return-address). * mail/mailvar.c: New variable "return-address". * mail/send.c (send_message): Obtain the return mail address from the "return-address" variable (if set). * NEWS: Update. * doc/texinfo/programs.texi: Update. ----------------------------------------------------------------------- Summary of changes: NEWS | 13 ++++++++++++- doc/texinfo/programs.texi | 14 +++++++++++++- mail/mail.c | 9 +++++++-- mail/mailvar.c | 3 +++ mail/send.c | 31 +++++++++++++++++++++++++------ 5 files changed, 60 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 7e55823..ac7dbdf 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -GNU mailutils NEWS -- history of user-visible changes. 2012-07-19 +GNU mailutils NEWS -- history of user-visible changes. 2012-08-07 Copyright (C) 2002-2012 Free Software Foundation, Inc. See the end of file for copying conditions. @@ -149,6 +149,17 @@ The mail shell provides the following new escapes to handle attachments: ~^ N Delete Nth attachment. +** mail: the -r option + +The meaning of the `-r' option has changed. Now it introduces the +return address to use when sending mail. This is an incompatible +change. + +The return address can also be set from the mail shell, by assigning +to the `return-address' variable, e.g.: + + set return-address "g...@gnu.org" + ** MH: improved compatibility with other implementations ** MH inc: new option --moveto diff --git a/doc/texinfo/programs.texi b/doc/texinfo/programs.texi index aaa66f5..4ba978d 100644 --- a/doc/texinfo/programs.texi +++ b/doc/texinfo/programs.texi @@ -2489,7 +2489,6 @@ Do not read the system-wide mailrc file. @xref{Mail Configuration Files}. Do not display initial header summary. @item -p @itemx --print -@itemx -r @itemx --read Print all mail to standard output. It is equivalent to issuing following commands after starting @samp{mail -N}: @@ -2499,6 +2498,9 @@ print * quit @end group @end example +@item -r @var{address} +@itemx --return-address=@var{address} +Sets the return email address for outgoing mail. @xref{return-address}. @item -q @itemx --quit Cause interrupts to terminate program. @@ -4371,6 +4373,16 @@ set replyregex="^(re|odp|aw|ang)(\\[[0-9]+\\])?:[[:blank:]]" @noindent (Notice the quoting of backslash characters). +@anchor{return-address} +@kwindex return-address +@item return-address +@*Type: String +@*Default: unset +@vrindex return-address, mail variable. + +Sets the return email address to use when sending messages. If unset, +the address is composed from the current user name and the host name. + @kwindex save @item save @*Type: Boolean. diff --git a/mail/mail.c b/mail/mail.c index 400bb0c..aad4246 100644 --- a/mail/mail.c +++ b/mail/mail.c @@ -47,7 +47,9 @@ static struct argp_option options[] = { {"nosum", 'N', NULL, 0, N_("do not display initial header summary"), 0}, {"print", 'p', NULL, 0, N_("print all mail to standard output"), 0}, - {"read", 'r', NULL, OPTION_ALIAS }, + {"read", NULL, NULL, OPTION_ALIAS }, + {"return-address", 'r', N_("ADDRESS"), 0, + N_("use address as the return address when sending mail"), 0}, {"quit", 'q', NULL, 0, N_("cause interrupts to terminate program"), 0}, {"subject", 's', N_("SUBJ"), 0, @@ -117,10 +119,13 @@ parse_opt (int key, char *arg, struct argp_state *state) break; case 'p': - case 'r': util_cache_command (&command_list, "setq mode=print"); break; + case 'r': + util_cache_command (&command_list, "set return-address=%s", arg); + break; + case 'q': util_cache_command (&command_list, "set quit"); break; diff --git a/mail/mailvar.c b/mail/mailvar.c index e0d1306..d74ccea 100644 --- a/mail/mailvar.c +++ b/mail/mailvar.c @@ -215,6 +215,9 @@ struct mailvar_symbol mailvar_tab[] = MAILVAR_TYPEMASK (mailvar_type_string), N_("regexp for recognizing subject lines of reply messages"), set_replyregex }, + { { "return-address" }, + MAILVAR_TYPEMASK (mailvar_type_string), + N_("return address for outgoing messages") }, { { "save", }, MAILVAR_TYPEMASK (mailvar_type_boolean), N_("store aborted messages in the user's dead.file") }, diff --git a/mail/send.c b/mail/send.c index 053a289..55fc246 100644 --- a/mail/send.c +++ b/mail/send.c @@ -185,7 +185,7 @@ send_attach_file (const char *name, if (!encoding) encoding = "base64"; mu_filter_get_list (&list); - rc = mu_list_locate (list, encoding, NULL); + rc = mu_list_locate (list, (void*) encoding, NULL); if (rc) { mu_error (_("unsupported encoding: %s"), encoding); @@ -777,24 +777,43 @@ send_message (mu_message_t msg) status = mu_mailer_create (&mailer, sendmail); if (status == 0) { + const char *return_address_str; + mu_address_t return_address = NULL; + + if (mailvar_get (&return_address_str, "return-address", + mailvar_type_string, 0) == 0) + { + status = mu_address_create (&return_address, + return_address_str); + if (status) + { + mu_error (_("invalid return address: %s"), + mu_strerror (status)); + mu_mailer_destroy (&mailer); + return status; + } + } + if (mailvar_get (NULL, "verbose", mailvar_type_boolean, 0) == 0) { mu_debug_set_category_level (MU_DEBCAT_MAILER, - MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT)); + MU_DEBUG_LEVEL_UPTO (MU_DEBUG_PROT)); } status = mu_mailer_open (mailer, MU_STREAM_RDWR); if (status == 0) { - status = mu_mailer_send_message (mailer, msg, NULL, NULL); + status = mu_mailer_send_message (mailer, msg, + return_address, NULL); mu_mailer_close (mailer); } else - mu_error (_("Cannot open mailer: %s"), mu_strerror (status)); + mu_error (_("Cannot open mailer: %s"), + mu_strerror (status)); mu_mailer_destroy (&mailer); + mu_address_destroy (&return_address); } else - mu_error (_("Cannot create mailer: %s"), - mu_strerror (status)); + mu_error (_("Cannot create mailer: %s"), mu_strerror (status)); } } else hooks/post-receive -- GNU Mailutils _______________________________________________ Commit-mailutils mailing list Commit-mailutils@gnu.org https://lists.gnu.org/mailman/listinfo/commit-mailutils