How to use the Linux mail command to attach a file

The key here is to use the "uuencode" command but note that we specify the file name twice (this must be done at least on Centos or it won\\\'t work).

  1. The first file.zip is the actual file we want to send.
  2. The second file.zip is the name of the file in the e-mail (you can change it if you like).

 


 

uuencode file.zip file.zip | mail email@yourdomain.com

 

Note that some e-mail clients won\\\'t receive the attachment properly sicne the correct MIME types/headers aren\\\'t being added (many clients will be OK but some won\\\'t.





Tags:

linux, attach, filethe, quot, uuencode, specify, centos, zip, email, yourdomain, attachment, sicne, mime, headers, aren, ok,

Latest Articles

  • Linux Bash Script To List All Connected IPs and their network name
  • Cisco Switches How To Get Of Port Line Status Console Messages
  • Cisco DHCP Snooping Relay Setup Information
  • Cisco Switch Setup Guide Command List
  • Cisco 2960 Switch Reset To Factory Defaults
  • How To Boot Cisco CUCM UCSInstall 8.6, 10, 11 and 12 on KVM/Proxmox
  • VBOX VirtualBox How To Import Raw .img Disk File
  • Windows Server 2012, 2016, 2019 How To Install and Missing Disabled Telnet Client
  • proxmox vm networking breaks when you restart your network on the hostnode
  • Linux ln symlink how to update existing symbolic link
  • Ubuntu 18.04 / Linux Mint 19.1 Cannot Type or Login - solution
  • LUKS Hard Drive Encryption on Linux Mint Ubuntu Debian etc how to mount encrypted hard drive
  • How to use nmap locate other machines/computers/servers on your network using nmap
  • Linux Mint 18.2 Create Config File To Start Application Upon Login
  • Dell Wyse Thin Client BIOS Access Key
  • sudoers file in /etc warning about comments/includes!
  • Centos 7 Reallocate logical volume space to another
  • lvm how to reduce volume size
  • letsencrypt certbot error "Unable to find a virtual host listening on port 80 which is currently needed for Certbot to prove to the CA that you control your domain. Please add a virtual host for port 80."
  • SSH error cannot Forward or Listen "bind: Cannot assign requested address"