- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Send mails with attachments
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
05-21-2002 02:30 AM
05-21-2002 02:30 AM
Send mails with attachments
i need some precious guidelines.
I need to send files (text, compressed, postscript or PDF) as email attachments.
I have an application generating the following parameters which i wish to forward to an email address:
===============================================
$1 Mail destination address
$2 Subject of Message
$3 Text file containing message
$4 Either 'delete' or 'nodelete' for $3
$5 Attach file (Output file which i want to send as attachment)
$6 Either "delete" or "nodelete" for $5
===============================================
After generating these values, my application will be calling a unix shell script.
e.g. (Makes $5 the mail body content.)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L-9iAS: d05/9iAS/6iserver/reports60/admin/mail>more r60mail.sh
#!/bin/csh -f
# Send mail message using Unix 'mail'.
#-------------------------------------
# Send mail message using 'mail'.
# When attachment exists, send attachment which is report output.
# When attachment doesn't exist, send message file which is notification.
if ($5 == '') then
mail $1 < $3
else
mail $1 < $5
endif
# Delete the message file.
if ($4 == 'delete') then
rm $3
endif
# Delete the attach file.
if ($6 == 'delete') then
rm $5
endif
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I have alread tried to use uuencode:
/usr/bin/uuencode $5 $5 | mailx -m -s $2 $1
Does not help much. The files attached comes out garbled!
It seems like i am having a MIME type issue.
I believe the use of ELM would be most appropriate here.
Anybody who has something working similar to this?
thank you in advance for a reply.
Best Regards
Yogeeraj
PS. i also tried to install "nail". It gives me an error during the make.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
root-L1000 #make
cd . && /depot/nail-9.30/missing autoheader
sh: /depot/nail-9.30/missing: Execute permission denied.
*** Error exit code 126
Stop.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2002 02:33 AM
05-21-2002 02:33 AM
Re: Send mails with attachments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2002 02:33 AM
05-21-2002 02:33 AM
Re: Send mails with attachments
replace mail -x with sendmail, eg;
uuencode /etc/hosts /etc/hosts | sendmail
And it shall come through as an attachment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2002 02:35 AM
05-21-2002 02:35 AM
Re: Send mails with attachments
http://bizforums.itrc.hp.com/cm/QuestionAnswer/1,,0x19e3ff77de2bd611abd50090277a778c,00.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2002 03:27 AM
05-21-2002 03:27 AM
Re: Send mails with attachments
for i in `echo filename1 filename2 filename3 ...`
do
uuencode $i $i.txt
done|mailx -m -s "test" username@whereever.com
The key is to have the right "suffix" on the uuencode line:
uuencode somefile somefile.pdf
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2002 04:28 AM
05-21-2002 04:28 AM
Re: Send mails with attachments
my attachment can be of any type!
how do i modify my script for it to work?
Also, if i was to modify the sender name and add a footer to each message sent?
E.g.
***********************************************
The attached document has been autogenerated by CMT applications.
If you are not the addressee indicated in this message (or responsible for delivering the message to the intended recipient), you should not read it, nor copy or deliver this message to anyone. ***********************************************
thank you in advance
Best Regards
Yogeeraj
--------------------------------------------
#!/bin/csh -f
if ($5 == '') then
mail $1 < $3
else
/usr/bin/uuencode $5 $5 | mailx -m -s $2 $1
endif
# Delete the message file.
if ($4 == 'delete') then
rm $3
endif
# Delete the attach file.
if ($6 == 'delete') then
rm $5
endif
--------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2002 04:47 AM
05-21-2002 04:47 AM
Re: Send mails with attachments
To add a footer first direct the output of your uuencode to a file;
uuencode
echo "Disclaimer .....blah blah blah" >>/tmp/temp.$$
Now your file /tmp/temp.$$ has your uuencoded file AND the disclaimer at the bottom.
Now you can send it using sendmail;
cat /tmp/temp.$$ | sendmail
Note, its very difficult to put a subject line on sendmail so try to get away without one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2002 04:58 AM
05-22-2002 04:58 AM
Re: Send mails with attachments
#
# Now send report to "sendto" via email
#
mailx -m -s "${subject}" ${sendto} 1>/dev/null << __EOF__
$(cat ${attachment} | ux2dos - | uuencode ${atach_name}.txt)
... Body of message ...
__EOF__
Using this method, you can have as many attachments as you want and put them anywhere in the body of the message. For binary files remove the "ux2dos" conversion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2002 06:04 AM
05-22-2002 06:04 AM
Re: Send mails with attachments
Sniplett from script:
BINDIR=/usr/bin
$BINDIR/touch /usr/local/squid/etc/mailer.txt
echo "[include /var/tmp/proxy_report.$DATE.zip application/octet-stream base64]" >>/usr/local/squid/etc/mailer.txt
$BINDIR/elm -s "Proxy Report" JohnDoe@Nowhere.com
I had lots of problems with sendmail with this, but some say it's easy. Just make sure your version of elm supports attachments.
Regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2002 06:11 AM
05-22-2002 06:11 AM
Re: Send mails with attachments
Here is an link which will help you :
http://www.stokely.com/unix.sysadm.resources/email.html#attachment.link
there are a variety of software like mpack etc which just need a single command to be type to send any type of attachments.
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2002 05:46 AM
05-23-2002 05:46 AM
Re: Send mails with attachments
I had been using this:
(
echo "Subject: Text in the subject line"
echo "Text in email body"
uuencode
) | /usr/sbin/sendmail recipient@comp.com
This works fine. You can add needed extension to
Andrej
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2002 03:09 AM
05-25-2002 03:09 AM
Re: Send mails with attachments
I have temporarily done the following modifications to my scripts:
===============================================
...
if ($5 == '') then
mail $1 < $3
else
if (`ls $5|cut -f 2 -d"."` == 'txt') then
echo "`cat $3` \n[include $5 text/plain base64]"|elm -s "$2" $1
else if (`ls $5|cut -f 2 -d"."` == 'pdf') then
echo "`cat $3` \n[include $5 application/pdf base64]"|elm -s "$2" $1
else if (`ls $5|cut -f 2 -d"."` == 'htm') then
echo "`cat $3` \n[include $5 text/html base64]"|elm -s "$2" $1
else
mail $1 < $5
endif
endif
# Delete the message file.
if ($4 == 'delete') then
rm $3
endif
# Delete the attach file.
if ($6 == 'delete') then
rm $5
endif
...
===============================================
Hope that i have not missed out anything.
Best regards
yogeeraj