On Monday 19 September 2005 06:15, Gary V. Vaughan wrote:
> The -f option to hostname is very linux specific; even coreutils hostname
> doesn't support it. Add a user overridable HOSTNAME variable that, by
> default, sets itself to the first of `hostname -f` or `hostname` that
> succeeds. With this patch, quilt mail works on Linux and Mac OS (at least)
> without any further intervention, and allows others to set HOSTNAME
> otherwise.
HOSTNAME is set to $(hostname) on many systems so with the patch, the domain
part would get lost -- not really useful.
I would also prefer adding a new option to the mail command rather than adding
more special .quiltrc variables. How about the attached patch instead? You
have convinced me that setting the envelope sender with -t by default is a
good idea.
-- Andreas.
Index: quilt/mail.in
===================================================================
RCS file: /cvsroot/quilt/quilt/quilt/mail.in,v
retrieving revision 1.7
diff -u -r1.7 mail.in
--- quilt/mail.in 18 Sep 2005 15:44:45 -0000 1.7
+++ quilt/mail.in 19 Sep 2005 09:34:50 -0000
@@ -21,7 +21,7 @@
usage()
{
- printf $"Usage: quilt mail {--mbox file|--send} [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...]\n"
+ printf $"Usage: quilt mail {--mbox file|--send} [--sender ...] [--from ...] [--to ...] [--cc ...] [--bcc ...] [--subject ...]\n"
if [ x$1 = x-h ]
then
printf $"
@@ -37,8 +37,13 @@
--send
Send the messages directly.
+--sender
+ The envelope sender address to use. The address must be of the form
+ [EMAIL PROTECTED]''. No display name is allowed.
+
--from, --subject
- The values for the From and Subject headers to use.
+ The values for the From and Subject headers to use. If no --from
+ option is given, the value of the --sender option is used.
--to, --cc, --bcc
Append a recipient to the To, Cc, or Bcc header.
@@ -52,7 +57,7 @@
msgid()
{
local timestamp=$(date --utc "+%Y%m%d%H%M%S.%N")
- echo "[EMAIL PROTECTED](hostname -f)"
+ echo "[EMAIL PROTECTED]@}"
}
process_mail()
@@ -66,13 +71,13 @@
--extract-recipients Bcc \
< $tmpfile)
if [ -n "$opt_send" ]; then
- echo mta "$@"
+ echo mta ${QUILT_MTA_ARGS--f "$opt_sender"} "$@"
@SCRIPTS@/edmail --charset $opt_charset \
--remove-header Bcc "$@" < $tmpfile \
- | mta "$@"
+ | mta ${QUILT_MTA_ARGS--f "$opt_sender"} "$@"
else
local from_date=$(date "+%a %b %e %H:%M:%S %Y")
- echo "From ${LOGNAME:-$(whoami)[EMAIL PROTECTED](hostname -f) $from_date"
+ echo "From $opt_sender $from_date"
sed -e 's/^From />From /' $tmpfile
echo
fi
@@ -80,7 +85,7 @@
}
options=`getopt -o h --long from:,to:,cc:,bcc:,subject: \
- --long send,mbox:,charset: -- "$@"`
+ --long send,mbox:,charset:,sender: -- "$@"`
if [ $? -ne 0 ]
then
@@ -92,6 +97,9 @@
while true
do
case "$1" in
+ --sender)
+ opt_sender=$2
+ shift 2 ;;
--from)
opt_from=$2
shift 2 ;;
@@ -128,6 +136,19 @@
then
usage
fi
+
+if [ -z "$opt_sender" ]; then
+ opt_sender="${LOGNAME:-$(whoami)[EMAIL PROTECTED](hostname -f 2>/dev/null)"
+ case "$opt_sender" in
+ [EMAIL PROTECTED]) ;;
+ *)
+ echo $"\
+Could not determine the envelope sender address. Please use --sender." >&2
+ exit 1
+ ;;
+ esac
+fi
+
if [ -z "$opt_charset" ]; then
case "${LC_ALL:-$LANG}" in
*.UTF-8)
@@ -155,7 +176,7 @@
Message-Id: <$(msgid)>
User-Agent: quilt/@[EMAIL PROTECTED]@RELEASE@
Date: $(date --rfc-822)
- From: $opt_from
+ From: ${opt_from:-$opt_sender}
To: $(IFS=,; echo "${opt_to[*]}")
Cc: $(IFS=,; echo "${opt_cc[*]}")
Bcc: $(IFS=,; echo "${opt_bcc[*]}")
_______________________________________________
Quilt-dev mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/quilt-dev