- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Sending a File as an Attachement using Sendmail
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2007 08:45 PM
09-16-2007 08:45 PM
I wish to send a file as an attachement using Sendmail, but it refuses to send it as an attachement.
I've tried the following with mailx
uuencode file file | mailx -s " " me@domain.com
Please help...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2007 08:50 PM
09-16-2007 08:50 PM
Solutionhi,
here is some tips
Sendmail
Example1:
(uuencode /etc/hosts /etc/hosts.txt;uuencode /etc/services /etc/services.txt)
| sendmail abc@hp.com
Note:
The ( ) around the uuencode is required
Example2:
cat /etc/hosts /etc/services > newfile ; cat newfile | sendmail abc@hp.com
WK
please assign points
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2007 08:58 PM
09-16-2007 08:58 PM
Re: Sending a File as an Attachement using Sendmail
Any reason you want to create newfile, instead of just piping the first cat of two files to sendmail?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2007 11:09 PM
09-16-2007 11:09 PM
Re: Sending a File as an Attachement using Sendmail
ux2dos myfile | uuencode someTitle.txt | mailx -m -s "my subject" you@somewhere.com
ux2dos will translate from Unix to DOS/PC style line terminators and the uuencode filename becomes the name for the attachment (which can be anything including the original filename).
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-16-2007 11:46 PM
09-16-2007 11:46 PM
Re: Sending a File as an Attachement using Sendmail
This script is pretty nifty.
http://www.hpux.ws/mailfile2
It actually uses sendmail though this is not a requirement. It's production quality code, used by myself and many others. If there are still default email addresses in there, please change them.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2007 06:15 AM
09-17-2007 06:15 AM
Re: Sending a File as an Attachement using Sendmail
Try using mpack to send the file instead:
http://hpux.ee.ualberta.ca/hppd/hpux/Users/mpack-1.6/
Run like so:
/usr/local/bin/mpack -s "svr004 cfg2html" /opt/cfg2html/svr004.html gwild@mydomian.ca
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 12:18 AM
09-18-2007 12:18 AM
Re: Sending a File as an Attachement using Sendmail
Now, how do I add this command in a script file?
(uuencode file file) | sendmail me@domain.com
The reason I ask is I want to create a cronjob that executes the script file to send me the e-mail with the attached file.
I added the command as it is a a script,but it does not work.
Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 12:36 AM
09-18-2007 12:36 AM
Re: Sending a File as an Attachement using Sendmail
2. Give full paths to command and your files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 01:42 AM
09-18-2007 01:42 AM
Re: Sending a File as an Attachement using Sendmail
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 02:24 AM
09-18-2007 02:24 AM
Re: Sending a File as an Attachement using Sendmail
just try the following
uuencode
For example
uuencode test test.rpt|sendmail sam (as defined in /etc/mail/aliases) or the full address is also possible of course
Regards
Franky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 02:40 AM
09-18-2007 02:40 AM
Re: Sending a File as an Attachement using Sendmail
Regards
Franky
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 04:27 AM
09-18-2007 04:27 AM
Re: Sending a File as an Attachement using Sendmail
# uuencode file file | mailx -m -s " " me@domain.com
~cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 05:31 AM
09-18-2007 05:31 AM
Re: Sending a File as an Attachement using Sendmail
I realize you are wanting to use sendmail, but as others posted, there are a myriad of ways to handle this with mailx.
I am attaching an inhouse doc we use quite frequently in our shop with many examples.
Regards,
-dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2007 06:07 AM
09-18-2007 06:07 AM
Re: Sending a File as an Attachement using Sendmail
mailx uses sendmail as a transport.
It makes no difference whether your code uses mailx or sendmail directly as does my script.
Take another look at my earlier post. It has the exact lines of code you want to use to do the job with sendmail.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2007 12:51 AM
09-19-2007 12:51 AM
Re: Sending a File as an Attachement using Sendmail
I want to execute two of these commands to attach to different files, but after I execute the script it does nothing
Help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2007 03:27 AM
09-19-2007 03:27 AM
Re: Sending a File as an Attachement using Sendmail
#!/usr/bin/sh
mailx -m -s "This is the subject" me@somplace.com << EOF
$(ux2dos /etc/profile | uuencode MyProfile.txt)
$(ux2dos /etc/hosts| uuencode MyHosts.txt)
$(ux2dos /etc/inittab| uuencode MyInittab.txt)
So there are 3 files here.
The uuencode filename is not local to your system, it is used to provide a title for
the attachment.
You can put lots of comments here or even
use a text file like this:
$(cat /etc/nsswitch.files)
This is the end...
EOF
-------------
Now notice that *full pathnames* are used, not something in your local directory. When cron runs, there is no login, no profile, just a simple environment.
Bill Hassell, sysadmin