Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mailx query

Status
Not open for further replies.

HHG

Technical User
Nov 8, 2003
68
0
0
GB
I have carried out a simple task in my script to email me as below:-

mailx -s "Message" emailaddress

When I type this in at the prompt or within a script the system is expecting a ctl-d before it gets sent.

Anyone know of a way around this. I am using bash/ksh and on solaris 10.

any help will be much appreciated. thanks in advance
 
Various options are
Code:
echo This is the message body | mailx -s subject me@myserver
or
Code:
mailx -s subject me@myserver < /path/to/file/with/contents

As a frinstance a script might go
Code:
run_process_with_output | mailx -s "Output from process" me@myserver
or
Code:
run_process > logfile
mailx -s "Process logfile" me@myserver < logfile

Ceci n'est pas une signature
Columb Healy
 
Hi

And the interactive way :
Code:
mailx -s "Message" emailaddress <<ENDOFMAIL
Look ma' !
No Ctrl-D !
ENDOFMAIL
Note that you can use different keyword instead of ENDOFMAIL.

Feherke.
 
Thanks Columb Healy I used the 1st suggestion and it worked a treat. Many thanks for your fantastic help again. Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top