Operating System - HP-UX
1748275 Members
3622 Online
108761 Solutions
New Discussion юеВ

Re: Can you send e-mail attachment using mailx

 
Jonathan Welbon
New Member

Can you send e-mail attachment using mailx

From a script want to send emails with attachments out over the internet. Can the mailx utility do this. Is it possible to use the Cc and Bcc with mailx??
12 REPLIES 12
Bart Beeren
Advisor

Re: Can you send e-mail attachment using mailx

For sending for example text file as attachment and that it can be opened by Windows do the following:

ux2dos YourDocument|uuencode YourDocument.txt|mailx -m -s "Here is your text document" email@domain.com

(usage of cc and bcc I don't know)

BB
Life isn├В┬┤t as simple as it seems
Pete Randall
Outstanding Contributor

Re: Can you send e-mail attachment using mailx

Jonathon,

This is just a sample of the hits I came up with by doing a boolean search of the forums on +mailx +attachment:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x99da35067c18d6118ff40090279cd0f9,00.html

Adding cc and/or bcc might prove just as fruitful.

Good luck,
Pete

Pete
Pete Randall
Outstanding Contributor

Re: Can you send e-mail attachment using mailx

Actually, Princess Paula's response in my previously identified thread addresses the Cc and Bcc issue, as well.

Pete

Pete
Sanjay_6
Honored Contributor

Re: Can you send e-mail attachment using mailx

Hi,

Just do a search on the forum for the solution you are looking for and you'll have the solution in no time at all.

Hope this helps.

Regds
Jonathan Welbon
New Member

Re: Can you send e-mail attachment using mailx

Thank You very much Bart. You have opened a door I could biegin to open......but.....

All of the emails are empty. I want to send attachment but I also want some information in the email itself.

Attached is my script I am testing....
Uday_S_Ankolekar
Honored Contributor

Re: Can you send e-mail attachment using mailx

Hello,
uuencode filename filename | | sendmail emailid. or mailx mailx mailid

ex:

uuencode /etc/passwd passwd.hostname | sendmail user@domain

-USA..
Good Luck..
Christophe MAILHE
Frequent Advisor

Re: Can you send e-mail attachment using mailx

If you want to send the file as attachement and not as part of the email, you need to use MIME.

I have attached a sample script I use to send text file as attachment.

Just replace "yourservername" by the hostname of your server and "yourcompany.com" by your domain name.

Chris.
Dave La Mar
Honored Contributor

Re: Can you send e-mail attachment using mailx

Sorry you do not seem to have the answer you wish.
As I read this, you wish to send an email with an attachment and a message in the body.
If so, this should do it -

mailx -m -s "Some Title" someone@somewhere.com << EOF
`ux2dos some.fil | uuencode somefile.txt`

Type some message here for the body.

EOF


Best of Luck,
dl
"I'm not dumb. I just have a command of thoroughly useless information."
A. Clay Stephenson
Acclaimed Contributor

Re: Can you send e-mail attachment using mailx

One of the easist tolls is elm from the command line especially if you are sendiing multiple attachments and text.

Within the body of your email add this:

------------------------------------

This is my text. How are you?


[include /tmp/myattach application/octet-stream base64]

This is some more text in the middle.

[include /tmp/myexcel.xls application/ms-excel base64]

This is a closing message in the email.

----------------------------------------



That will attach /tmp/myattach and /tmp/myexcel.xls. You can include multiple attachments using this method.


Then to use it from a script:
elm -s "My Subject" dumbo@mailserver.com < myletter

Where myletter contains the attachment include statement as well as your message text. It is also necessary that you have a .elm directory
under the senders home directory because unlike the interactive version of elm the command-line version will not create a .elm directory automatically.

If it ain't broke, I can fix that.