summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS13
-rw-r--r--doc/texinfo/programs.texi14
-rw-r--r--mail/mail.c9
-rw-r--r--mail/mailvar.c3
-rw-r--r--mail/send.c31
5 files changed, 60 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index 7e55823c0..ac7dbdf00 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 "gray@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 aaa66f5ce..4ba978dc7 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 400bb0c2d..aad424696 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 e0d1306cd..d74ccea33 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 053a28979..55fc2467d 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

Return to:

Send suggestions and report system problems to the System administrator.