Find the answer to your Linux question:
Results 1 to 9 of 9
I tried to use mail functionality of linux to send email to others, but don't know how to attach a file, can anybody help? Thanks,...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2011
    Posts
    13

    how to send email in linux with attachment?


    I tried to use mail functionality of linux to send email to others, but don't know how to attach a file, can anybody help? Thanks,

  2. #2
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    What do you mean by "mail functionality"? If you're using a specific command, you can check its man page by running the command:
    Code:
    man COMMAND
    in the terminal.

  3. #3
    Just Joined!
    Join Date
    Nov 2011
    Posts
    13
    I don't know which command specifically to use. I looked the command mail, but it does not seem to provide attachment functionality. Maybe I missed something, but really appreciated for any further help.

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,049
    It really depends on what you're trying to do. If you just want a functional desktop, then it should be easy using any graphical email client to attach files. Thunderbird and Evolution come to mind, as does kmail.

    If however you want to use the command line to send email, you can use several command line email clients such as Mutt or Pine. But if you want to use email functionality from scripts or automated processes, then you can use the mailx command directly.

    It goes something like this:
    Code:
    echo "This is the message body"|mailx -s "subject" -a /path/to/attachement recipient@example.bla
    Can't tell an OS by it's GUI

  6. #5
    Just Joined!
    Join Date
    Nov 2011
    Posts
    13
    Quote Originally Posted by Freston View Post
    It goes something like this:
    Code:
    echo "This is the message body"|mailx -s "subject" -a /path/to/attachement recipient@example.bla
    Thanks, this is really what I need. I ssh to some terminal and generate some graph there, and then want to send these graphs to several email addresses, so, can mailx send something to multiple email address?

  7. #6
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,049
    Yes, just use a comma separated list. Or read the man page for more details, because you can also cc, bcc or define the sender field.
    Can't tell an OS by it's GUI

  8. #7
    Just Joined! jonyo's Avatar
    Join Date
    Dec 2006
    Posts
    37
    Quote Originally Posted by bsmile View Post
    I tried to use mail functionality of linux to send email to others, but don't know how to attach a file
    just like in win for me, click click, regardless of OS,

    usually involves clicking on an attachment box,

    then a bigger pop up box comes up where you find the file and click on it,
    ,
    usually that shows up in the email compose page so you know before sending that there is an attachment(s) with the email

    i'm talking the typical yahoo, gmail, aol, etc options
    Last edited by jonyo; 01-31-2012 at 02:50 AM.

  9. #8
    vkp
    vkp is offline
    Just Joined!
    Join Date
    Oct 2012
    Posts
    1

    Command and steps to send mail with attachment:

    Quote Originally Posted by bsmile View Post
    I tried to use mail functionality of linux to send email to others, but don't know how to attach a file, can anybody help? Thanks,
    Below is command using mutt to attach mail

    mutt -s "subject" -a "/usr/MyAttachment.txt" me@you.com < tempBody.txt

  10. #9
    Linux Newbie mactruck's Avatar
    Join Date
    Apr 2012
    Location
    City of Salt
    Posts
    187
    uuencode <input.file> <output.file> | mail -s " your subject here" name@domain.com

Posting Permissions

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