Re: sendmail (112 Views)
Reply
Super Advisor
himacs
Posts: 611
Registered: ‎01-27-2009
Message 1 of 7 (112 Views)
Accepted Solution

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
Honored Contributor
Mel Burslan
Posts: 3,214
Registered: ‎08-26-1998
Message 2 of 7 (112 Views)

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
Steven E. Protter
Posts: 33,806
Registered: ‎08-15-2002
Message 3 of 7 (112 Views)

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
R.K. #
Posts: 705
Registered: ‎05-20-2008
Message 4 of 7 (112 Views)

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
Regular Advisor
subodhbagade
Posts: 132
Registered: ‎06-08-2008
Message 5 of 7 (112 Views)

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
himacs
Posts: 611
Registered: ‎01-27-2009
Message 6 of 7 (112 Views)

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
R.K. #
Posts: 705
Registered: ‎05-20-2008
Message 7 of 7 (112 Views)

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
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.