Operating System - HP-UX
1828036 Members
1931 Online
109973 Solutions
New Discussion

Re: sending attachment using sendmail

 
SOLVED
Go to solution
Shivkumar
Super Advisor

sending attachment using sendmail

Hi,

We are running sendmail email server. I want to send attachment in the email.

Can someone please let me know how to do that ?

Thanks,
Shiv
11 REPLIES 11
Vibhor Kumar Agarwal
Esteemed Contributor

Re: sending attachment using sendmail

You will require uuencode.
Vibhor Kumar Agarwal
Ninad_1
Honored Contributor

Re: sending attachment using sendmail

Hi,

You can use

uuencode filename | mailx -m -s "subject" email_address

Regards,
Ninad
Peter Godron
Honored Contributor
Solution

Re: sending attachment using sendmail

Shiv,
somebody already produced a script you can modify:
http://www.hpux.ws/mailfile2
sajeer_2
Regular Advisor

Re: sending attachment using sendmail

Sp4admin
Trusted Contributor

Re: sending attachment using sendmail

Hi Shiv,

I know this doesn't answer your question, but there is a Network Security Vulnerability with sendmail 8.12.9. The Vulnerability is "Buffer overflow". Just a heads up.

sp,
Doug O'Leary
Honored Contributor

Re: sending attachment using sendmail

Hey;

Check out

http://www.olearycomputers.com/ll/mcsg/mcsg_mkpkg.html

for instructions on using sendmail to send mime attachments.

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Steven E. Protter
Exalted Contributor

Re: sending attachment using sendmail

Hi Shiv,

In the USA this week.

http://www.hpux.ws/mailfile2

Full featured, production and easy to understand and modify.

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
Marvin Strong
Honored Contributor

Re: sending attachment using sendmail

Hey Doug, I think you pasted the wrong linky.

Although thats a nice service guard writeup ;p

Not being a mail guru I would think you can just specify everything to sendmail with a heredoc.

cat << eof
to
from
subject
mime-version
content-type
body
content-disposition: attachment; filename=stuff
eof | sendmail -t

That is most likely missing some stuff. But if you get the structure correct that should be able to do it. Much easier with uuencode though.

If your just sending a text file and dont need it to be an attachment. (not what your asking I realize)

# echo "To: you@yourdomain.com\nSubject: your subject\nContent-Type: text/html\
n\n"`cat /path/to/somefile.html` | sendmail -t



Doug O'Leary
Honored Contributor

Re: sending attachment using sendmail

Crap, Marvin, you're right.

sorry all:

http://www.olearycomputers.com/ll/mail_attach.html

Try that link...

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
Rita C Workman
Honored Contributor

Re: sending attachment using sendmail

All great answers, and since anything can be done many ways...here's another....

I use an old simple method...the 'include' file. It's free-it's easy-it works well in scripts and from command line. All things I like...

Yep just a simple file that looks like this:
[include /path/file text/plain base64]

Now this little file can be modified to send most anything from text to pdf. Another example for MS Word doc:
[include /path/file application/msword base64]

To mail this file sitting on the HPUX box I just enter:
elm -s "Here's the file" anybody@anywhere.com < /path/include.file

Got this from an old document: NALKBRC0001803" Information on mailing attachments using unix mailers. Date 3/25/2000

Rgrds,
Rita
vinod_25
Valued Contributor

Re: sending attachment using sendmail

Hi Shiv

Mail messages with attachments should be mime configured if the receiving User Agent is mime compatible.

If not use uuencode (preferred shar)...

To send a binary file (nvtd) to a remote user.

shar (uses uuencode)

shar -cmos nvtd | sendmail -v @
.com

uuencode (Most useragent programs know uuencode)

With sendmail:

uuencode nvtd nvtd | sendmail -v @
.com

Groupwise knows uudecoded protocol.

Do the following to mail file "db":

uuencode db db | sendmail -v user@host

The following message should appear: smtp message delivered...

Send an attachment to me ;-) with lot of points asusual..

regds,
Vinod