Results 1 to 7 of 7

Thread: send multiple files by email with mutt?

  1. #1
    Join Date
    Oct 2008
    Location
    /usr/bin/
    Beans
    484
    Distro
    Ubuntu

    send multiple files by email with mutt?

    Hello,

    I want to send 20 files 01.txt to 20.txt by email from the command line using mutt

    the following works fine for 1 file
    mutt -s "1 file" me@gmail.com -a /home/john/Documents/1.txt < mailmessage.txt

    the following works fine for all files in the folder
    mutt -s "all files" me@gmail.com -a /home/john/Documents/*.txt < mailmessage.txt

    but how can I just send 01.txt to 20.txt ?

    thanks

  2. #2
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    11,301
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: send multiple files by email with mutt?

    If you want just to select files with the pattern [number][number].txt, you can use

    Code:
    mutt -s "all files" me@gmail.com -a /home/john/Documents/[0-9][0-9].txt < mailmessage.txt
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  3. #3
    Join Date
    Oct 2008
    Location
    /usr/bin/
    Beans
    484
    Distro
    Ubuntu

    Re: send multiple files by email with mutt?

    Quote Originally Posted by SeijiSensei View Post
    If you want just to select files with the pattern [number][number].txt, you can use

    Code:
    mutt -s "all files" me@gmail.com -a /home/john/Documents/[0-9][0-9].txt < mailmessage.txt
    thanks

  4. #4
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: send multiple files by email with mutt?

    {01..20} is better because it wont include 99.
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  5. #5
    Join Date
    Oct 2008
    Location
    /usr/bin/
    Beans
    484
    Distro
    Ubuntu

    Re: send multiple files by email with mutt?

    thanks guys

    I would like to take this a step further so I can attach files using find. so it will recurse through the specified folder and attach all .doc files, something like the following which didnt work for me..

    mutt -s "recursive doc file" me@gmail.com -a find -type f -name /home/john/Documents/*.doc < mailmessage.txt

  6. #6
    Join Date
    Jul 2007
    Location
    Poland
    Beans
    4,499
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: send multiple files by email with mutt?

    Code:
    shopt -s globstar
    mutt -s "recursive doc file" me@gmail.com -a ~/Documents/**/*.doc < mailmessage.txt
    or
    Code:
    docs=()
    while read -rd $'\0' f; do docs+=( "$f" ); done < <( find ~/Documents -iname '*.doc' -print0 )
    mutt -s "recursive doc file" me@gmail.com -a "${docs[@]}" < mailmessage.txt
    if your question is answered, mark the thread as [SOLVED]. Thx.
    To post code or command output, use [code] tags.
    Check your bash script here // BashFAQ // BashPitfalls

  7. #7
    Join Date
    Oct 2008
    Location
    /usr/bin/
    Beans
    484
    Distro
    Ubuntu

    Re: send multiple files by email with mutt?

    perfect, thanks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •