1834926 Members
2297 Online
110071 Solutions
New Discussion

Re: Mailx

 

Mailx

How to send an attachment file and a message
through mailx?
(I am able to send either a message or an attachment {using uuencode} but not both together)
7 REPLIES 7
Rita C Workman
Honored Contributor

Re: Mailx

David Peacock
Frequent Advisor

Re: Mailx

I suggest:

#mailx name@example.com

~r(filename)

Here is some text

.

veni, vidi, vmstat
Dan Hetzel
Honored Contributor

Re: Mailx

Hi,

If the file you want to attach is in binary form, use the following:

uuencode your_file_name attachment_name | sendmail -v user@host

If it's plain text, you may use 'elm':

elm -s 'Subject Line' user@host < file.txt

Best regards,

Dan
Everybody knows at least one thing worth sharing -- mailto:dan.hetzel@wildcroft.com
Darrel Louis
Honored Contributor

Re: Mailx

Hi,

man mailx

-m Do not add MIME header lines Mime Version, Content Type & Content Encoding to the header information while sending mails.

example
# uuencode /tmp/testfile testfile.txt | mailx -m -s 'testje' test@mail.com

Check the following discussion:
http://my1.itrc.hp.com/cm/QuestionAnswer/1,1150,0xa408a24d9abcd4118fef0090279cd0f9!0,00.html

Good Luck

Re: Mailx

Thanks, but let me repeat my problem.
If I say
mailx -s "Test Subject" xxxxx.com < test1.txt
I am able to send the mail with the subject and test1.txt
appearing as the body of the mail.
Or If I say
uuencode test2.txt test2.txt | mailx -s "Test Subject" xxxxx.com
I am able to send the mail with the subject and the test2.txt appearing as an attachment with the mail.
My requirement is to send the mail with the subject and
test1.txt appearing as body of the mail and test2.txt as an attachment to the same mail.(Hope I am not asking for too much).
Also pl tell me how to send multiple attachments with the
same mail.

regards,
Bala

Re: Mailx

Friends,
My problem is solved.
(Assume that "test1.txt" has the contents for the body of the mail, "test2.txt" has the contents for the first attachment and "test3.txt" has the contents for the second attachment)

CODE:
uuencode test2.txt test2.txt >> test1.txt
uuencode test3.txt test3.txt >> test1.txt
mailx -s "Test Subject" xxxxx.com < test1.txt

This sends a mail with the subject and a body and 2 attachments.

"Test Subject" is sent as the SUBJECT of the mail.

test1.txt is sent as the BODY of the mail.

test2.txt is sent as ATTACHMENT 1 in the mail.

test3.txt is sent as ATTACHMENT 2 in the mail.

Thanks for the help extended by you all.

Happy new year to everybody.....!
regards,
Sreekanth
Tracey
Trusted Contributor

Re: Mailx

I create another intermediate file to do this.

aappend this line to the end of your first text file:

[include /tmp/test2.txt text/plain quoted-printable]

and then:

elm -s "Subject" me@home
this will include the file in the quotes, but use the text up until that point.