Mailx via script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Mailx via script
# 1  
Old 06-22-2006
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
# 2  
Old 06-22-2006
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

Last edited by braindrain; 06-22-2006 at 04:50 AM..
# 3  
Old 06-22-2006
Try this inside your script:

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

Regards.
# 4  
Old 06-22-2006
Grial,
I tried that already, but it didn't help, double quote to variable makes sures variables read as variables(??).
# 5  
Old 06-22-2006
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' !!!
# 6  
Old 06-22-2006
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... Smilie

One more thing. As matrixmadhan, my mailx does not accept "-R"...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mailx, Table, Multiple Email script

Hello, I am able to write some simple scripts in linux but this time it seems a little bit hard for me. Objective: Script will read Database.txt file and will submit separate emails to multiple persons. Database.txt Elvis-Presley user_ssh1 ##20140403 firstperson@gmail.com Julia-Roberts... (3 Replies)
Discussion started by: baris35
3 Replies

2. Shell Programming and Scripting

Mailx command not working in the script

when i am using Mailx command from AIX box, i am getting the following errors : uuencode: not found. mailx: not found. but when i executed the mailx command as shown below it worked cat /etc/hosts | mailx -v -s "test email" user@server.com It works fine in the production server. ... (2 Replies)
Discussion started by: pyaranoid
2 Replies

3. Shell Programming and Scripting

How to extract the subject from a script which uses mailx

Hi, I need to extract the subject of an e-mail sent using mailx. mailx is in a a file and the command reads like the following Ex: sendMail.sh mailx -s ' This is the subject' $recepiant note that anything can come within ' ' which goes to the subject. Please help (5 Replies)
Discussion started by: mwrg
5 Replies

4. Shell Programming and Scripting

mailx script to do multiple emails

I am looking for a script that I can use with mailx to do the following: 1. Grab usernames from a flat file (one at a time) 2. Attach a file to the email and mail out. Thanks. Cubefeed (3 Replies)
Discussion started by: CubeFeed
3 Replies

5. Shell Programming and Scripting

Mailx: How to send a attachment using mailx command

Hi All, Can anyone please provide the command for sending an mail with attachment using mailx command. Thanks in Advance :) Regards, Siram. (3 Replies)
Discussion started by: Sriram.Vedula53
3 Replies

6. Shell Programming and Scripting

Mailx Recipient and Name Script

Hi To All, I have a file with email addresses, most of which have names associated with them, it looks like this: http://img230.imageshack.us/img230/8255/94731317.th.jpg I am trying to come up with a script to use mailx (or anything else really) to send an email to... (4 Replies)
Discussion started by: slicker
4 Replies

7. Shell Programming and Scripting

Mailx in shell script (KSH)

Greetings all, I'm pretty new to the use of mailx, having been using mutt most of the time. I'm interested to know how I can use mailx within a shell script to send out a formatted email with the following criterion: 1. My recipient's address is abcdef1000@gmail.com 2. The message body is... (2 Replies)
Discussion started by: rockysfr
2 Replies

8. Shell Programming and Scripting

Script to delete all mail in mailx

Hello all, Can some help me write a small script that when executed will delete all mail in mailx? I am having issues where /var is getting full often due to a lot of mail being stored, I would like to run a script on cron which would delete mail every 2 days, any help is much appreciated. (1 Reply)
Discussion started by: sqloyd
1 Replies

9. UNIX for Dummies Questions & Answers

mailx error message : mailx: NUL changed to @

If I use the "Mail" link instead of the "mail" link to ../mailx I get this error. Mail so-n-so @whatever.com mailx: NUL changed to @ Unknown command: "postmaster" The email still goes through but i get the error. If I use "mail" it goes thru without the error. Any ideas?? (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

10. Shell Programming and Scripting

unable to do mailx from shell script

Hi From within a shell script my mailx doesnt seem to work...can somebody tell me what is wrong... #!/bin/ksh #Script to verify wheather all databases listed are up and running #Script works with Oracle8 and above databases #Script has to be run by ./scriptname DBA=xiamin@unix.com echo... (3 Replies)
Discussion started by: xiamin
3 Replies
Login or Register to Ask a Question