Avatar of davidiwharper
davidiwharperFlag for Australia asked on

Email a GZIP attachment in a bash script

Hello everyone

I am trying (and failing) to write a shell script which can email a GZIP archive as an attachment from my web host's shared server. I've tried following multiple sets of instructions found online with little success. Sometimes the email comes through in gobbledygook (looks like the GZIP file is inline rather than attached), sometimes the GZIP file is present but can't be opened in 7-Zip, sometimes the scripts I've based off of just fail.

So I'd like to start afresh. The web host has (unfortunately) no mutt available, so that easy solution is off the table.

Has anyone got a working script sample I can adapt?

Thanks!
David
LinuxShell ScriptingLinux Networking

Avatar of undefined
Last Comment
davidiwharper

8/22/2022 - Mon
Pepe2323

Hi

Have you tried to use mailx?

mailx -a /path/to/file email@address

regards.
ASKER CERTIFIED SOLUTION
davidiwharper

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
davidiwharper

Well you know the old saying, if you want it done right do it yourself. Tried a bunch of sendmail/mail/mailx variants, plus a python script, and finally hit the jackpot with Perl.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck