the message just seems to go into cyberspace and not my inbox?

Does mailx work when you run it from the command line? If not, then maybe your mail system isn't configured properly? Have you checked your system's logs and checked your mailbox for bounced mails? If mailx does work from the command line, then note that you need to check the return value of system for errors - see its docs, but the bare minimum is system(...)==0 or die "\$?=$?";

I've put the curly braces around the variables to try to avoid interpolation

Sorry, that's not how that works, "${foo}" is just another way of writing "$foo". The best way to avoid interpolation is to use the form of system that does not call the shell, where you give system a list of arguments with more than one element. But if you don't go through the shell, you also won't get pipe I/O redirection, which you could solve by a two-step process where the file is first encoded into a temporary file (File::Temp). Or, you could use a module like IPC::Run, which supports I/O redirection. I wrote about this whole topic at length here.

However, I'd strongly recommend against shelling out in the first place. See Email::Stuffer, here's something adapted from its Synopsis:

use Email::Stuffer; Email::Stuffer->from('sender@example.com') ->to('user01@email.org')->subject("logs for $pkgname") ->text_body('Here's the log file.') ->attach_file("$logpath.zip") ->send;

In reply to Re: Trouble emailing zip file by haukex
in thread Trouble emailing zip file by TonyNY

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.