Mailutils: specifically mailx not behaving like Mint or Ubuntu

Hiya, i'm new here and new to Zorin. Beautiful UI btw.

This issue has prompted me to sign up.

I'm trying to set up a fresh install of Zorin to do some tasks each week, and then email me a report. I've set this up successfully in the past on Mint (21.3) and on Ubuntu (24.04). I can get the email to work, but not completely. It can't send an attachment. I also had to employ a different syntax. Basically, mailx on Zorin does not understand -A and -a doesn't work to attach files to the email. It does on Ubuntu and Mint.

So i went-a-huntin' for information and it seems there's different implementations of mailx out there. But that said, both Mint and Zorin are based on Ubuntu, and i've installed the mailutils package the same way: sudo apt install mailutils.

This guy had a similar problem, sadly no actual solutions were offered: email - Difference between mail and mailx? - Unix & Linux Stack Exchange

I tried to invoke the help, and it has a problem on Zorin:

$ mailx --help

mailx: invalid option -- '-'
usage: mailx [-dEIinv] [-a header] [-b bcc-addr] [-c cc-addr] [-r from-addr] [-s subject] [--] to-addr ...
       mailx [-dEIiNnv] -f [name]
       mailx [-dEIiNnv] [-u user]


vs

Ubuntu (or Mint):

$ mailx --help

Usage: mailx [OPTION...] [address...]
  or:  mailx [OPTION...] [OPTION...] [file]
  or:  mailx [OPTION...] --file [OPTION...] [file]
  or:  mailx [OPTION...] --file=file [OPTION...]
GNU mail -- process mail messages.
If -f or --file is given, mail operates on the mailbox named by the first
argument, or the user's mbox, if no argument given.

  -A, --attach=FILE          attach FILE
  -a, --append=HEADER: VALUE append given header to the message being sent
      --[no-]alternative     force multipart/alternative content type
      --attach-fd=FD         attach from file descriptor FD
      --content-filename=NAME
                             set the Content-Disposition filename parameter for
                             the next --attach option
      --content-name=NAME    set the Content-Type name parameter for the next
                             --attach option
      --content-type=TYPE    set content type for subsequent --attach options
  -E, --exec=COMMAND         execute COMMAND
  -e, --exist                return true if mail exists
      --encoding=NAME        set encoding for subsequent --attach options
  -F, --byname               save messages according to sender
  -H, --headers              write a header summary and exit
  -i, --ignore               ignore interrupts
  -M, --[no-]mime            compose MIME messages
  -N, --nosum                do not display initial header summary
  -n, --norc                 do not read the system mailrc file
  -p, --print, --read        print all mail to standard output
  -q, --quit                 cause interrupts to terminate program
  -r, --return-address=ADDRESS
                             use address as the return address when sending
                             mail
  -s, --subject=SUBJ         send a message with the given SUBJECT
      --[no-]skip-empty-attachments
                             skip attachments with empty body
  -t, --to                   read recipients from the message header
  -u, --user=USER            operate on USER's mailbox

 Global debugging settings
      --debug-level=LEVEL    set Mailutils debugging level
      --[no-]debug-line-info show source info with debugging messages

 Configuration handling
      --config-file=FILE     load this configuration file; implies --no-config
      --config-lint          check configuration file syntax and exit
      --config-verbose       verbosely log parsing of the configuration files
      --no-config            do not load site and user configuration files
      --no-site-config       do not load site-wide configuration file
      --no-user-config       do not load user configuration file
      --set=PARAM=VALUE      set configuration parameter

 Informational options
      --config-help          show configuration file summary
      --show-config-options  show compilation options

  -?, --help                 give this help list
      --usage                give a short usage message
  -V, --version              print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Report bugs to <bug-mailutils@gnu.org>.
GNU Mailutils home page: <http://mailutils.org>
General help using GNU software: <http://www.gnu.org/gethelp/>

Zorin uses an older version of mailutils vs my Ubuntu 24.04, but Mint's version is older too. 3.17 is the latest. So i screwed around, not really knowing what i'm doing and i managed to get 3.17 installed on Zorin:

sudo apt install mailutils

mailutils is already the newest version (1:3.17-1.1build3).

Don't worry, this is currently on a VM while i work out how to do things in Zorin - i really didn't expect it to be much different to Mint under the hood. Sadly my janky efforts didn't make a difference. Exactly the same situation.

I'm at a loss. I've invested a fair bit of time and effort into my scripts that make use of mailx, so i'd rather not change them if i don't have to.

I'd love some ideas :slight_smile: Thanks.

Hi, and welcome!

Did you run sudo apt update first? I can install mailutils just fine at version 3.14 which includes the attachment option.

1 Like

hi @zenzen :slight_smile: Yeah, i sure did. When i say a clean install, it's about a fortnight old. I've been playing with it for a bit. But it was pretty darned clean.

VERY interesting that your Zorin 'behaved'. I can't think of what i might've done to break it. I wonder what i might've done... :thinking: Anyway, I've just downloaded the iso again and i'll try doing the mail thing straight up.

That'll be tomorrow though. Thanks for your quick reply.

Welcome to the Forum!

Do you use Zorin 16 Core or Zorin 17 Core?

1 Like

I may have been just that, I used Zorin OS 17 (based on Ubuntu 22.04).

Hiya!

I'm using 17.1

I did a brand new 17.1 install in a VM, and did the update/upgrade and installed mailutils.

Interesting - this installed differently. I recall on the previous occasion, i was not prompted with the ascii prompt which asks for something about the type of host (i didn't grab the details). I remember that prompt from my Ubuntu and Mint installs. It simply didn't appear in the previous install.

Checking mailx --help on this occasion provided the expected and correct outcome.

Maybe the previous install had a problem somewhere. Do you happen to know how to force a re-installation of mailutils?

You could try the Terminal Command sudo apt reinstall [Package-Name]

1 Like

I looked it up sudo apt --reinstall install [pkg]

Disclaimer - since experiencing the issue i initially described, i tried quite a few things so anything i do now could easily be borked.

yep. It's borked :smiley:

installation of mailutils is not possible, it cannot be downloaded.

That's on the bad VM. The good, brand new VM, all fine.

I guess i screwed something up. But i'm at a bit of a loss as to what it might've been.

Anyway: solution - new install of Zorin :smiley:

You can still try sudo dpkg --configure <pkg_name> to run all the post-install scripts for that package. At this point, and considering it's a VM, it may good to check.

I find it strange that this option (attachment) is not present even on older version of the package. I think it's a misconfiguration issue, or something that went badly during installation or something.

Hi again @zenzen !

Thanks for the suggestion. Sadly...

zorin@VM-Zorin:~$ sudo dpkg --configure mailutils
[sudo] password for zorin:      
dpkg: error processing package mailutils (--configure):
 package mailutils is already installed and configured
Errors were encountered while processing:
 mailutils

She borked :slight_smile: