Re: Mailutils+nullmailer: sender full name
On Tue 17 Oct 2023 at 19:41:43 (+0200), Gertjan Klein wrote:
> Op 17-10-2023 om 19:10 schreef Geert Stappers:
> > On Tue, Oct 17, 2023 at 05:43:55PM +0200, Gertjan Klein wrote:
> > > I am configuring a new VPS, and decided to try nullmailer to send mail.
> > > I don't want to receive mail on the VPS, I just want the mail the system
> > > generates to end up in my mailbox elsewhere. This works, but the mail
> > > from address looks like this: "gklein <gklein@parvos.nl>". This irks me.
> > > My account has my full name configured;
> >
> > Where exactly is the full name configured?
>
> I meant the user account on that machine:
>
> gklein@parvos:~$ cat /etc/passwd | grep gklein
> gklein:x:1000:1000:Gertjan Klein,,,:/home/gklein:/bin/bash
On my (bullseye) system, that field is what is used to get my full
name. I tested it by inserting my middle initial in place of
the space, and then sending an email with:
$ mail -s Test3 myusername@thishost.corp
Cc:
[^D typed here as I had nothing to say]
Null message body; hope that's ok
$
I did try to strace mail, but it would produce a return code of 1 and
not send the email. However, this did show that as well as opening
/etc/passwd (several times, at different stages), it looked for the
following files in different ways:
access("/etc/mailutils.rc", F_OK) = -1 ENOENT (No such file or directory)
stat("/etc/mailutils.conf", 0x7fffdbdbf9d0) = -1 ENOENT (No such file or directory)
stat("/home/myusername/.mail", 0x7fffdbdbf9d0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/mail.rc", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/myusername/.mailrc", O_RDONLY) = -1 ENOENT (No such file or directory)
(Note that I don't personally send mail this way—I use mutt, of course.)
> > |$ ls -l /usr/bin/bsd-mailx
> > |-rwxr-xr-x 1 root root 112968 Apr 14 2022 /usr/bin/bsd-mailx
> > [ … ]
>
> That shows that your mail executable is actually bsd-mailx. If you
> also use nullmailer, that means mailutils is the culprit here:
No, my system uses mailutils:
$ aptitude why mailutils
i emacs-gtk Depends emacs-bin-common (= 1:27.1+1-3.1+deb11u2)
i A emacs-bin-common Recommends mailutils
$
but emacs wasn't responsible for installing it. That was exim4, which
was installed about four minutes earlier. But exim4 Recommends mailx,
and bsd-mailx also Provides mailx, so I don't know why mailutils was
favoured over bsd-utils. Ironically, bsd-mailx is in the netinst
installer's pool, whereas mailutils isn't. So it may just depend on
chance—the order in which you happen to install other packages.
(Aside: does anyone know what "heirloom-mailx" is?)
> gklein@parvos:~$ command -v mail
> /usr/bin/mail
> gklein@parvos:~$ ls -l /usr/bin/mail
> lrwxrwxrwx 1 root root 22 Mar 3 2023 /usr/bin/mail ->
> /etc/alternatives/mail
> gklein@parvos:~$ ls -l /etc/alternatives/mail
> lrwxrwxrwx 1 root root 23 Mar 3 2023 /etc/alternatives/mail ->
> /usr/bin/mail.mailutils
>
> My mail is from package mailutils, as described, and it doesn't (by
> default) appear to use the full name from /etc/passwd. I had expected
> this to 'just work', seeing as "Mailutils is a swiss army knife of
> electronic mail handling". I can, of course, switch to a different
> MTA. But it's difficult for me to believe this can't be done with this
> 'Swiss army knife'.
I don't know much/anything about nullmailer, or why you chose it.
(But then, the only reason I use exim4 is because I know how to
# dpkg-reconfigure exim4-config
it.) However, I do see the following in nullmailer's man pages:
"SYNOPSIS
sendmail [ flags ] [ recipients ] < message
"DESCRIPTION
This program is a front end program for nullmailer-inject and null‐
mailer-smtpd. It is used by programs that expect a sendmail interface
for sending email. After parsing the command-line arguments, this pro‐
gram executes either nullmailer-inject or nullmailer-smtpd depending on
the presence of the -bs option on the command-line. See the documenta‐
tion for nullmailer-inject for details on how messages are reformatted
and queued."
and:
"SYNOPSIS
nullmailer-inject [-a] [-b] [-e] [-f sender] [-h] [recipient [recipient
...]]
"DESCRIPTION
This program reads a email message from standard input, reformats its
header to comply with RFC822, and sends the resulting message to the
queue.
"HEADER FIELDS
The following lines are parsed for recipient addresses: To, Cc, Bcc,
Apparently-To, Resent-To, Resent-Cc, and Resent-Bcc.
The following sender address lines are parsed and rewritten: Sender,
From, [ … ]"
and:
"This file lists all the major user-visible changes to nullmailer.
-------------------------------------------------------------------------------
Changes in version 2.2
[ … ]
"- nullmailer-inject now sets the full name of the sender to the user
name as a fallback. This helps distinguish system sent messages when
the MTA rewrites the address (as does GMail, for example)."
I can't judge the significance of any of this for you—just observations.
Cheers,
David.
Reply to: