BladeSystem Forums have moved here
To make BladeSystem information easier to find, we have moved the BladeSystem forums here, to Servers and Operating Systems.
Showing results for 
Search instead for 
Do you mean 

sendmail

SOLVED
Go to Solution
Super Advisor

sendmail

Hi Gurus,

i want to send mail with attachment and body using mailx.

i used below command

uuencode file1 file1|mailx -m -s "Report" abc@xyz.com < body.txt

we are recieving mail with only body contents but not with attachment

plz guide me


regards
himacs
6 REPLIES
Honored Contributor

Re: sendmail

you can try this:

(cat body.txt; uuencode file1 file1)| mailx -m -s "report" abc@xyz.com

HTH
________________________________
UNIX because I majored in cryptology...
Exalted Contributor

Re: sendmail

Shalom himacs

Take a look at this script:
http://www.hpux.ws/?p=7

There is a working script in there. You can adapt it easily to your needs.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Honored Contributor

Re: sendmail

Hi Himacs,

Following are different methods for mail attachments:

SENDING EMAIL WITH ATTACHMENT- 1
# uuencode /etc/lvmconf/vg00.mapfile /etc/lvmconf/vg00.mapfile | elm -s "test att" rk@abc.com -JUNK

SENDING EMAIL WITH ATTACHMENT- 2
# ux2dos /etc/lvmconf/vg00.mapfile | uuencode /etc/lvmconf/vg00.mapfile | mailx -m -s "Test" rk@abc.com -WORKING

SENDING EMAIL WITH ATTACHMENT- 3
# mailx -m -s "Hello" rk@abc.com << END
`ux2dos /home/abc/.cshrc | uuencode /home/abc/.cshrc.txt`
`ux2dos /home/abc/.profile | uuencode /home/abc/.profile.txt`

SENDING EMAIL WITH ATTACHMENT- 4
# elm -- TUI

SENDING EMAIL WITH ATTACHMENT- 5
# mail -t rk@abc.com << end
> Subject : test with attach
> $( uuencode /etc/lvmconf/vg00.mapfile /etc/lvmconf/vg00.mapfile)
> $( uuencode /etc/lvmconf/vg00.conf /etc/lvmconf/vg00.conf)
> end

Regds,
R.K
Don't fix that what ain't broke
Highlighted
Regular Advisor

Re: sendmail

Hi,


>how to send the attachment through sendmail/mailx

(1)#uuencode LOGS.txt LOGS.txt | mailx -s " subject " user@xyz.com

this will send the mail with attachment .....if you are not able read the txt then save it and open with wordpad.

here is the diffrence between eg (1) & (2)

(2)# mailx -s " subject " user@xyz.com
this will send the mail with body (content ) of txt.


Regards,
Subodh.
Super Advisor

Re: sendmail

Hi,

Thanx for the responses..and sorry for my delayed reply..

please guide me send more than one attachment in single file.

regards
himacs
Honored Contributor

Re: sendmail

The easiest way is to use "elm" -- TUI based electronic mail.

# elm

You will see something like below:

You can use any of the following commands by pressing the first character;
d)elete or u)ndelete mail, m)ail a message, r)eply or f)orward mail, q)uit
To read a message, press . j = move down, k = move up, ? = help

Command: m
Send the message to: abc@xyz.com
Subject of message: xxxxxxx
Copies to: def@xyz.com

>>Vi editor open here for typing a message, type and save and quit

Then you will be prompted:
Please choose one of the following options by parenthesized letter: s
e)dit message, edit h)eaders, s)end it, a) attachments or f)orget it. <<= select what you want, example "a" to add attachment.

a
Attachments:
a)dd, e)dit, d)elete, m)odify, q)uit
a
Filename: /tmp/my_attachment1 <<== type full path of req file
Hit return

Attachments:
a)dd, e)dit, d)elete, m)odify, q)uit
a
Filename: /tmp/my_attachment2 <<== type full path of req file
Hit return

Attachments:
a)dd, e)dit, d)elete, m)odify, q)uit
q

Please choose one of the following options by parenthesized letter: s
e)dit message, edit h)eaders, s)end it, a) attachments or f)orget it.

s

Mail sent!

Command: q

#
#

So this is how you can send multiple attachments via elm.

Hope this is what you are looking for.

Regds,
R.K.
Don't fix that what ain't broke