Attchment in mailx command is not happening

Attchment in mailx command is not happening with -a option .
Please find below command I tried

mailx -s "test"  -a abc.txt alokjyotibal@gmail.com

Which operating system/version is it?

The mailx '-a' switch is a relatively new option which is not supported on all implementations. Check your man page:

man mailx
Linux ausulgcemeaap02.us.dell.com 2.6.32-431.el6.x86_64 #1 SMP Wed Nov 20 23:56:07 PST 2013 x86_64 x86_64 x86_64 GNU/Linux

---------- Post updated at 08:06 AM ---------- Previous update was at 07:58 AM ----------

Okay, is the attachment file in the same directory that you are in?

Does the mailx command not output an error?

For good measure, try giving the full pathname of the attachment.

file is in same path . but when i ecxecute this command , it seems it is waiting for some input

file is in same path.

thanks.

Yes, it's waiting for the email text to be input. If you terminate that the email should go with just a title and attachment.

For example, put your email text in a file called 'mailfile'

Then try this:

 
 echo "mailfile" | mailx -s "test"  -a "abc.txt" alokjyotibal@gmail.com
 

thank you it worked :slight_smile:

iam the one who is doing this in my pre-prod env...

i had used the mailx as well. but it is not working.

thanks.

@maddelav......You still have something with mailx not working? Please explain.

EDIT: Two days and no response from maddalev. alokjyotibal (the OP) is happy so tagging this solved.