Home » Infrastructure » Unix » Regarding MAILX
Regarding MAILX [message #233060] Tue, 24 April 2007 08:54 Go to next message
shahnazurs
Messages: 240
Registered: June 2005
Location: India
Senior Member
Hi,
~< ! uuencode /etc/passwd passwords

I have just used this command, could you please explain how this is working?

Shahnaz.
Re: Regarding MAILX [message #233066 is a reply to message #233060] Tue, 24 April 2007 09:07 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Doesnt the
man uuencode command work for you ?

Quote:
oracle@S0221834# man uuencode



should give something like this

Re: Regarding MAILX [message #233136 is a reply to message #233066] Tue, 24 April 2007 23:17 Go to previous messageGo to next message
shahnazurs
Messages: 240
Registered: June 2005
Location: India
Senior Member
Thanks for your advice

i want to know what is that
~< !

Shahnaz
Re: Regarding MAILX [message #233191 is a reply to message #233136] Wed, 25 April 2007 02:59 Go to previous messageGo to next message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

You can use it for adding attachment, found an example

Quote:
echo "Send the E-mail message..."
/usr/bin/mailx -s "${SUBJECT}" ${TO} <<-EOF
Hi,

This sample E-mail message demonstrates how one can attach
files when sending messages with the Unix mailx utility.

First attachment: SQL*Plus spool file
~< ! uuencode $SPOOLFILE `basename $SPOOLFILE`

Second attachment: mailx.ksh (this script)
~< ! uuencode mailx.ksh mailx.txt

Third attachment: /etc/passwd file
~< ! uuencode /etc/passwd passwords

Best regards

~.
EOF

echo "Done!"




Source
Re: Regarding MAILX [message #233453 is a reply to message #233191] Thu, 26 April 2007 03:19 Go to previous messageGo to next message
shahnazurs
Messages: 240
Registered: June 2005
Location: India
Senior Member
Thanks,

/usr/bin/mailx -s "${SUBJECT}" ${TO} <<-EOF

in the above command why we need to use -EOF instead of EOF?

because here document definition is

<<anything
...
...
anything

Shahnaz.
Re: Regarding MAILX [message #233568 is a reply to message #233453] Thu, 26 April 2007 11:20 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
"-" allows you to indent the here-doc with tabs (but not spaces).
The man pages for mailx describe "~<!"

[Updated on: Wed, 02 May 2007 17:46]

Report message to a moderator

Re: Regarding MAILX [message #235780 is a reply to message #233568] Tue, 08 May 2007 00:32 Go to previous messageGo to next message
shahnazurs
Messages: 240
Registered: June 2005
Location: India
Senior Member
Thanks Andrew.

i just tried couple of scenarios

1>>>

$mailx -s "HI" xyz@gmail.com<<-EOF
>hi
><tab>how are you?
>EOF

o/p

hi
how are you?


2>>>

$mailx -s "HI" xyz@gmail.com<<EOF
>hi
><tab>how are you?
>EOF

o/p

hi
<tab>how are you?

Do we have in mailx command, any option to send cc (corbon copy)??

Thanks.

Re: Regarding MAILX [message #235799 is a reply to message #235780] Tue, 08 May 2007 01:10 Go to previous message
tahpush
Messages: 961
Registered: August 2006
Location: Stockholm/Sweden
Senior Member

Quote:
1. Mail No attachment, body only -

mailx -m -s "Some Subject" somone@somewhere.com < file_for_email_body

2. Mail with attachement, no body -

ux2dos /path_to/some_file | uuencode some_file.txt | mailx -m -s "MAIL FROM Someone" someone@somewhere.com

3. Mail with attachment and body -

ux2dos /path_to/some_file | uuencode some_file.txt | mailx -m -s "MAIL FROM Someone" someone@somewhere.com < file_for_email_body

4. Mail with carbon and blind carbon -

mailx -m -s "Some Subject" somone@somewhere.com < file_for_email_body

(Note that this does not work with the -r option as it disables ~ commands.)
(The file_for_email_body should look like this - )
~c someone_to_cc@somewhere.com
~b someone_to_bc@somewhere.com
The remainder of this file can be the text body of the email.

5. Mail with multiple attachments and body (Leave out the 'This is all you get' if body not desired) -

mailx -m -s "Hello" someone@somewhere.com << END
`ux2dos /home/dlamar/.kshrc | uuencode /home/dlamar/.kshrc.txt`
`ux2dos /home/dlamar/.profile | uuencode /home/dlamar/.profile.txt`
This is all you get.
END


Source
Previous Topic: Script to run oracle packeges
Next Topic: ssh to server
Goto Forum:
  


Current Time: Thu Nov 28 15:24:24 CST 2024