Mailx via script

Hi,
using mailx,

cat file1 | mailx -v -R somebody@org.com -s 'This is subject message' nobody@org.com

Problem here is the subject of the email gets truncated after the first space, i.e emails are receving with subject "This" instead of "This is subject message"

any idea what is wrong ?

Thnx

sorry, i wasn't elobrative enough..

I call mailx from script, from command line if I use double quote I the get the subject as such, however when I use it via scripting, It's not
My script has following statement

cat $3 | mailx -v -R somebody@org.com -s $1 $2

my execution statement is

./script1.sh "This is subject message" nobody@org.com file.txt

I do get an email , however as I mentioned before the subject has only 'This' and not the full text

Try this inside your script:

cat $3 | mailx -v -R somebody@org.com -s "$1" $2

Regards.

Grial,
I tried that already, but it didn't help, double quote to variable makes sures variables read as variables(??).

what is the version of mailx you are using and under which OS ?

In solaris 5.9 mailx 5.0 there isnt any option with '-R' !!!

I've tested the code (Debian Linux + bash) I posted and worked.
I don't know what could be the problem...
Try "echo $1" inside the script to see what's its value... :slight_smile:

One more thing. As matrixmadhan, my mailx does not accept "-R"...