Operating System - HP-UX
1748180 Members
4344 Online
108759 Solutions
New Discussion юеВ

Re: Mail attachment from command line

 
SOLVED
Go to solution
Raja_2
Advisor

Mail attachment from command line

Hello,

I hope,I find answer for my problem. ;)

I need sent text file via mail to Exchange server. I've tried something like this :

mailx -s 'subject' name@domain < file,
elm -s 'subject' name@domain < file ([include ******])

but not works ....

I can sent attachment via elm menu but I need it from command line ...

Radim
11 REPLIES 11
James R. Ferguson
Acclaimed Contributor

Re: Mail attachment from command line

Raja_2
Advisor

Re: Mail attachment from command line

Hi James,

I had tried it before I wrote this email. :(
It doesn't work. I read about patch, which solve problem with elm but it's for 10.20 and I'm using 11.00. I'm not sure if the problem is in the 11.00.

Problem :
I have log file from sqlplus in good format, when I recived it via mail so the format is bad. I have idea sent this file like attachment and it's all what I need ....

Thx in advance

Radim
Stefan Farrelly
Honored Contributor

Re: Mail attachment from command line


The link James pointed to you is pretty good, have you tried all the replies from it ?

Sending text files to exchange as attachments is easy, use uuencode;

uuencode | mailx ......

Works fine on our site. If mailx no good try using sendmail.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Raja_2
Advisor

Re: Mail attachment from command line

Wow,

now I'm cleverer ...
It works only with sendmail - enough for me.
One question - I hope last ... :)
Which parameters I have to use when I want to specify subject, because -s isn't right.
Robin Wakefield
Honored Contributor

Re: Mail attachment from command line

Hi Radim,

With sendmail, you specify the subject in the message body as follows:

Subject: This is the subject

Rest of message..
.....
.....
.....

In other words, begin the 1st line with "Subject: ", followed by an empty line (no spaces, tabs, etc.), followed by the rest of the message.

Rgds, Robin.
Raja_2
Advisor

Re: Mail attachment from command line

Hi Robert,

you're right.

But I'd like have more ...
Mail with txt file and subject. I'm afraid that this combination isn't possible ..

Do you agree with me ?
Rita C Workman
Honored Contributor

Re: Mail attachment from command line

Ah, mailing attachments. One of my favorite things..

Mailing a text file requires alittle 'tweeking', from the command line. Take a look at this thread for some info on this:

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

Regards,
Rita
Robin Wakefield
Honored Contributor
Solution

Re: Mail attachment from command line

Hi Radim,

This worked for me:

==================================
(echo Subject: This is a test

echo hello ;uuencode /tmp/s.pl /tmp/s.pl) | sendmail robin.wakefield@ubsw.com
==================================

Let me know how you get on.

Rgds, Robin.
Deshpande Prashant
Honored Contributor

Re: Mail attachment from command line

HI
This is how I use on my machines.
#/usr/bin/uuencode report.txt report.txt |mailx -m -s "Performance Report for host "

Thanks.
Prashant.
Take it as it comes.