Operating System - HP-UX
1748051 Members
4693 Online
108758 Solutions
New Discussion юеВ

Re: Sendmail with attachment?

 
SOLVED
Go to solution
Tan Shirley
Frequent Advisor

Sendmail with attachment?

Hi,

Anyone has any idea how to use a command line to send a mail with attachment (plain text file, eg, test.txt) using sendmail ?

I actually intend to write a program so that it will generate a text file and automatically send it out using sendmail.

The sendmail patch I have is
PHNE_17190 1.0 sendmail(1m) 8.8.6 patch

Please help ! I have someone telling me to use uuencode command then pipe to sendmail. Prior to that have to use the ux2dos as well. Tried already but still receive garbage. Can't see the text file attachment at all.
Please help !!!!
Thanks !


Regards,
Shirley
8 REPLIES 8
Tom Danzig
Honored Contributor

Re: Sendmail with attachment?

uuencode | sendmail whomever@wherever.com
Tan Shirley
Frequent Advisor

Re: Sendmail with attachment?

Hi Tom,

Thanks for your help. Your command does work on some mail clients, but some displayed garbage when I tested using the same text file for attachment.
But anyway, do you have any idea how to append the mail with a subject? I realised that the recipient received the mail without a subject.

Thanks !
Satish Y
Trusted Contributor

Re: Sendmail with attachment?

Hi,

The mail will show garbage only, you need to save it as file_to_send.mail and execute cmd:

uudecode file_to_send.mail

Then u can see actual text.


If u want to send it with subject:

uuencode file_to_send encoded_file | mailx -s "subject" friend

Hope this may helps you


Cheers....
Satish.
Difference between good and the best is only a little effort
Satish Y
Trusted Contributor

Re: Sendmail with attachment?

Sorry, mistake in previous mail....
You need to save the mail with .mail extension and execute uudecode command.

Cheers...
Satish.
Difference between good and the best is only a little effort
Tan Shirley
Frequent Advisor

Re: Sendmail with attachment?

Hi Satish,

Thanks for your help. But what's the difference when I use sendmail and mailx to send my email?
Rita C Workman
Honored Contributor

Re: Sendmail with attachment?

Just so you have other options on sending mail as attachments...take a look at this thread:

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


As with all in UNIX...there's always more options,

/rcw
Ray Evans
Advisor

Re: Sendmail with attachment?

Take a look at the man for mpack and munpack. We use the munpack for extracting files and it works well.
Satish Y
Trusted Contributor
Solution

Re: Sendmail with attachment?

Hi,

From man pages of sendmail:

" sendmail sends a message to one or more recipients, routing the message over whatever networks are necessary. sendmail does internetwork forwarding as necessary to deliver the message to the correct place.

sendmail is not intended as a user interface routine; other programs provide user-friendly front ends; sendmail is used only to deliver pre-formatted messages.
..................................
.................................."

Means it depends on whether you are sending mail within network or internetwork and also whether it is pre-formatted or not.

And as far as I know you cannot attach subject with sendmail.


You can use:

mailx -s"subject" friend < test.txt

Hope this helps you...

Cheers....
satish.
Difference between good and the best is only a little effort