Operating System - HP-UX
1847084 Members
5232 Online
110262 Solutions
New Discussion

Attempting to send email attachments from and HP-UX 11.00

 
SOLVED
Go to solution
MAD_2
Super Advisor

Attempting to send email attachments from and HP-UX 11.00

I have been trying to send attachments by means of different methods provided in a previous forum. However, I do not seem to be successful either with elm, mailx, uuencode, or sendmail. These are the methods I used so far with their results:

Sending to:
Tested with MS Outlook 98 and 2000 Corporate or Workgroup editions email accounts and also to an Outlook Express 5.x.
File types:
One .jpg image
One .doc MS Word doc (format 97) to PCs with Word 97 or Word 2000.

Sendmail going through a Relay mail server.

Methods used:
1. For each
uuencode file1.jpg file1.jpg | mailx -m -s "This is a test" email@domain.com

Result: The file was embedded in the body of the email with uncomprehensible characters.

2. Text file created with input file information (let's call it /tmp/elmtst.txt) -- contents of file are the .jpg and .doc files:

[include /tmp/swagent_log.doc application/octet-stream]
[include /tmp/friend.jpg application/octet-stream]

Command line:

elm -s "This is a test" email@domain.com < /tmp/elmtst.txt

On the screen:
Result, output:

Include file has BINARY data.
Include file has BINARY data.
Include file has BINARY data.
Include file has BINARY data.
Sending mail...
Mail sent!


Result: The image file (although transfered to the server as binary file), when received in the outlook account (it is an attachment) it becomes distorted. The MS Word document cannot be opened??? (The File is sent to a PC with either Outlook 98 or 2000 and MS Word 97 or 2000 respectively -- File is in MS Word 97 format).

Things I still have to try:

Use mpack 1.5 or mutt mail client 1.4

More info about these here:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x6b3fc4c76f92d611abdb0090277a778c,00.html

Any other suggestions? Something possibly not configured correctly in sendmail or the relay server?
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
19 REPLIES 19
steven Burgess_2
Honored Contributor

Re: Attempting to send email attachments from and HP-UX 11.00

Hi

Have you tried the below script

#!/usr/bin/sh

export EMAIL_TO=username@receiving.email
export EMAIL_FROM=username@sending.email
export EMAIL_SUBJECT="subject of e-mail"
export EMAIL_BODY=/tmp/body_of_e-mail
export FILE_NAME=filename.txt
export ATTACHED_FILE=/tmp/file_to_attach

{
echo To: $EMAIL_TO
echo From: $EMAIL_FROM
echo Subject: $EMAIL_SUBJECT
echo 'MIME-Version: 1.0'
echo 'Content-type: multipart/mixed; boundary="xxxxyyyzzqzzyyyxxxx"'
echo '--xxxxyyyzzqzzyyyxxxx'
echo ''
cat $EMAIL_BODY
echo '--xxxxyyyzzqzzyyyxxxx'
echo 'Content-Disposition: attachment; filename="'$FILE_NAME'"'
echo ''
cat $ATTACHED_FILE
echo '--xxxxyyyzzqzzyyyxxxx--'
} | /usr/sbin/sendmail $EMAIL_TO

HTH

Steve
take your time and think things through
T G Manikandan
Honored Contributor
Solution

Re: Attempting to send email attachments from and HP-UX 11.00

Did you check this link

the active answers read on the forum.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x41950559ff7cd4118fef0090279cd0f9,00.html
Frank Slootweg
Honored Contributor

Re: Attempting to send email attachments from and HP-UX 11.00

> Methods used:
> 1. For each
> uuencode file1.jpg file1.jpg | mailx -m -s "This is a test" email@domain.com

As mentioned in the other thread, do *not* use "-m"!

That sounds 'backwards'/wrong, but it causes mailx to be 'dumb' and Outlook to be 'smart', and it works (for me).

You say that you tested without "-m" and that it didn't work, but my advice/request is to try *again*, because for *me* it *does* work (details in the other thread) and perhaps you (also) made another change which caused the failure.

BTW, I think it is not wise to start another thread while your problem is not yet solved. It *is* good that you gave a summary and a pointer to the other thread, but now people have to jump between the threads to see what was (not) said in the other thread. I think that posting your summary *in* the old thread would have been better.

Also please post a pointer to this thread in the old thread.
MANOJ SRIVASTAVA
Honored Contributor

Re: Attempting to send email attachments from and HP-UX 11.00

Hi Adam


mpack should ideally work as we have the same working in our production env , you amy like to look at the following too:

http://www.stokely.com/unix.sysadm.resources/email.html#attachment.link

Manoj Srivastava
Justo Exposito
Esteemed Contributor

Re: Attempting to send email attachments from and HP-UX 11.00

Hi Adam,

As I tell you in the other thread the problem is in the method used to transfer the files between the PC and the unix machine, try the following:

"I've got your problem trying in my system, the problem is when you transfer the gif file from windows environment to UNIX environment you transfer the file as an ascii file, then when you send it by mail obtain a corrupted file.

Try to ftp the gif file to the unix box as a binary transfer method and then send it by mail with your original instruction:
uuencode file.gif file.gif | mailx -m -s "Test" email@address.com

This must works perfect, I'd checked. "

Regards,

Justo.
Help is a Beatiful word
Charles Harris
Super Advisor

Re: Attempting to send email attachments from and HP-UX 11.00

Hi,

Just a quick thought, last time I encountered encoding problems, I gzipped the file before attaching as a mail. Then resend as before, kind of a dodgey work around for the problem.......

Cheers,

-ChaZ-
Sanjay_6
Honored Contributor

Re: Attempting to send email attachments from and HP-UX 11.00

Hi,

I've tried the mpack command and it transferred the binary file for me. That was the reason i had suggested you to download and try mpack in your last post. like i had suggested you can download and install it from the hp porting site,

http://hpux.cs.utah.edu

Hope this helps.

Regds
Sanjay_6
Honored Contributor

Re: Attempting to send email attachments from and HP-UX 11.00

Hi,

I just sent a ms-word doc file using mpack and it was received correctly on my workstation.

Hope this helps.

Regds
Rita C Workman
Honored Contributor

Re: Attempting to send email attachments from and HP-UX 11.00

Well when I want to send something using 'include' that's a word or excel file I do it this way:

[include file.xls application/msexcel base64]

[include file.doc application/msword base64]

I don't generally send gif or jpg's, but I'll put some out on my HPUX and I'll give it a try and see if I can get the syntax worked out for you...

Rgrds,
Rita
Rita C Workman
Honored Contributor

Re: Attempting to send email attachments from and HP-UX 11.00

Hi again !

Well found tons of jpg files out under /opt/tngfw/browser/images/wvicons I liked earth.jpg and sent myself that file from my HPUX box to my GroupWise account and opened it up on my PC, using nothing special...and voila...it was earth !

All I used was a simple include that said..

[include ~/wvicons/earth.jpg images/jpeg base64]

Rgrds,
Rita
Hai Nguyen_1
Honored Contributor

Re: Attempting to send email attachments from and HP-UX 11.00

Adam,

I have tried the following SENDMAIL which worked!

# (echo "Subject: Your_Subject"; uuencode file1.jpg file1.jpg) | sendmail email@domain.com

Hai
MAD_2
Super Advisor

Re: Attempting to send email attachments from and HP-UX 11.00

Thanks everyone for your replies.

I will give consideration to each and probably attempt all. I am normally off from Tuesday through Thursday, so I probably will not try the downloads (like mpack) until that day, but I will definitely attempt the other methods, possibly from home. After I go through each and depending on my success rate I will assign due points. I will post another message once I can scream "EUREKA"!

Thanks again. By the way, Justo, all of my FTP transfers have been binary; I never transfer a file in ASCII unless I know for sure the file is simple text only; that's not the problem in my situation, but I will look into Rita's recommendations (that may be the problem!)
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
Chris Lonergan
Advisor

Re: Attempting to send email attachments from and HP-UX 11.00

Download a copy of nail from the HP porting centre - http://hpux.connect.org.uk/hppd/hpux/Networking/Mail/nail-9.30/

Use is similar to elm, mail, mailx etc. but the attachments can be sent using the -a option.

e.g. nail [ -iInv ] [ -s subject ] [ -a attachment ] [ -c cc-addr ] [ -b bcc-addr ] [ -r from-addr ] to-addr . . .
Bart Beeren
Advisor

Re: Attempting to send email attachments from and HP-UX 11.00

Hi,

If I'am mailing documents to Windows as attachments, I do use the following command:

ux2dos document.whatever |uuencode document.|mailx -m -s "Test for mailing as attachment" email@domain.com


Hope this helps (I'm sure it works for normal text), BB.
Life isn´t as simple as it seems
MAD_2
Super Advisor

Re: Attempting to send email attachments from and HP-UX 11.00

Excellent Rita,

I followed your suggestion and that did the trick. I will also look into the other applications mentioned here and will give you all points accordingly, however to send you my replies it will be a while longer. For now, Rita's suggestion was simple and worked perfectly. Thanks a lot everyone!

P.S. I know I still owe some of you points, they will come a little while later.
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
MAD_2
Super Advisor

Re: Attempting to send email attachments from and HP-UX 11.00

Manoj and Sanjay,

The mpack solution also works perfectly, just got a chance to try it today. Now I have a couple of ways to resolve our problem, mpack which I can use for single files (a very simple syntax from the command line too) and then elm for a number of files. Great! I will see about the others later (nail and mutt I think it is). Thanks everyone.
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
Frank Slootweg
Honored Contributor

Re: Attempting to send email attachments from and HP-UX 11.00

What *is* Rita's solution *exactly*?

I know that it is "[include ....]", but an include in *what*? I *assume* in elm(1), but I would like to be sure. Also which version, HP-UX release, etc..

MAD_2
Super Advisor

Re: Attempting to send email attachments from and HP-UX 11.00

Frank,

Previously I had used A. Clay Stephenson's solution (he has always provided me with some great answers) as described below (see this forum answer -- (http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x6b3fc4c76f92d611abdb0090277a778c,00.html):

1. Create a simple text file with input file(s) information (let's call it /tmp/elmtst.txt) -- contents of file are a .jpg, .doc, and .html files:

[include /tmp/swagent_log.doc application/octet-stream]
[include /tmp/friend.jpg application/octet-stream]
[include /tmp/HotmailPage.html application/octet-stream]

Command line:

elm -s "This is a test" email@domain.com < /tmp/elmtst.txt

The include portion was either creating some altered or corrupt files. Then Rita recommended to change the [include to]...

[include /tmp/swagent_log.doc application/msword base64]
[include /tmp/friend.jpg image/jpeg base64]
[include /tmp/HotmailPage.html application/hmtl base64]

For the image I have also used: [include /tmp/friend.jpg application/jpeg base64]

Either one works perfectly!

P.S. I have an RP5470 with HP-UX 11.00
Contrary to popular belief, Unix is user friendly. It's just very particular about who it makes friends with
Rita C Workman
Honored Contributor

Re: Attempting to send email attachments from and HP-UX 11.00

Hi Admin,

This is for Frank....hope you don't mind..

Here's a thread that gives some details on what I suggested. You can do a search for mail attachments too. Basically, I found an old HP document that explained using the 'include' method, when I needed to address sending reports from the UNIX boxes to end users (i.e. save paper..) and since the 'include' cost $00 - it was perfect for me !

http://my1.itrc.hp.com/cm/QuestionAnswer/0,,0x41950559ff7cd4118fef0090279cd0f9!0,00.html

Share & Enjoy !
Rita