Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Answers to Frequently Asked Questions How do I send email? MAIL question for HP-Unix O/S Post 16178 by dsthompson on Tuesday 26th of February 2002 03:38:26 PM
Old 02-26-2002
MAIL question for HP-Unix O/S

Has anyone written a script to attached a text file when sending an email using the MAIL command?

I wrote a Unix Script to email an end-user a text file. I want the file to be an attachment. I've tried the unix command uuencode but this seems to be for a binary file. My text file is garbage (binary) when it's opened from within the email.
---------------------------------------------------------
****** SAMPLE SCRIPT BELOW ******
---------------------------------------------------------
uuencode $LG_TOP/bin/ARPSONIC.txt $LG_TOP/bin/SONIC.txt > $LG_TOP/bin/dst.tst
to=dsthompson@upslogistics.com
from=dsthompson@upslogistics.com
cc=dsthompson@upslogistics.com
echo 'To:'$to > $LG_TOP/bin/dst.tmp
echo 'From:'$from >> $LG_TOP/bin/dst.tmp
echo 'Cc:'$cc >> $LG_TOP/bin/dst.tmp
echo 'Return-receipt: Yes' >> $LG_TOP/bin/dst.tmp
echo 'Subject: UPS Logistics Files ' >> $LG_TOP/bin/dst.tmp
echo 'Dear Customer' >> $LG_TOP/bin/dst.tmp
echo ' '>> $LG_TOP/bin/dst.tmp
echo 'Please find attached File' >> $LG_TOP/bin/dst.tmp
echo ' '>> $LG_TOP/bin/dst.tmp
echo 'Thank you'>> $LG_TOP/bin/dst.tmp
echo ' '>> $LG_TOP/bin/dst.tmp
echo 'Deborah S. Thompson'>> $LG_TOP/bin/dst.tmp
cat $LG_TOP/bin/dst.tmp $LG_TOP/bin/dst.tst > $LG_TOP/bin/dst.tmp1
RECIPIENTS=$to,$cc
mail $RECIPIENTS < $LG_TOP/bin/dst.tmp1
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Mail question?

Hi, all, I use mail to send a file to my email account as follow: mail -v user@address.com < /user/text however, I received is a blank email without any content in it. How can I set up config correctly in the Solaris box? Any suggests so can send the whole text? Thank you in advance! Yun (2 Replies)
Discussion started by: yxiao
2 Replies

2. UNIX for Dummies Questions & Answers

can not send mail from unix server to company/yahoo mail

hi, Gurus, I need some help with sending mail out from my UNIX server: It is running Solaris 2.6 and the sendmail version is 8.8. Output of :/usr/lib/sendmail -d0.1 -bt < /dev/null Version 8.8.8+Sun Compiled with: LOG MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND NDBM NETINET ... (5 Replies)
Discussion started by: b5fnpct
5 Replies

3. UNIX for Dummies Questions & Answers

question on mail server

Hi In the company I work for one guy ask me this question: Can you have several mail servers managing the same domain, in the same lan? My first answer was that it's not possible cause each mail server must not share a domain, but .... I'm not sure. Can anyone more enlightened than me,... (1 Reply)
Discussion started by: piltrafa
1 Replies

4. UNIX for Dummies Questions & Answers

I am not able to send mail form unix to other mail accounts.

Using Mailx command i.e mailx -s "subject" chinni@hotmail.com < \tmp\chin this command executed sucessfully but not able to receive the mail in chinni@hotmail.com please help. (1 Reply)
Discussion started by: chinnigd
1 Replies

5. UNIX for Dummies Questions & Answers

mail question here

how can I use a file as a contact list for the mail command? (1 Reply)
Discussion started by: lostinfaith
1 Replies

6. Shell Programming and Scripting

Mail attachment with unix mail

Hi Could someone help me with the details on how to send an attachment through mail in unix. I have an html file in my unix machine and I want this to be send to some mail id, plese help with the steps. Regards Ajay (2 Replies)
Discussion started by: ajaykumarboyana
2 Replies

7. UNIX for Dummies Questions & Answers

Unix mail to personal mail, Strange behavour

Hi. I am running a script on solaris 10 and mailing it to my personal email. the script is ran as user xxx, And i have edited the crontab for user xxx to run the script and mail it to my email account. /network_check.sh | /usr/bin/mailx -s "Network Test" k454@hotmail.com the sript... (2 Replies)
Discussion started by: k00061804
2 Replies

8. UNIX for Advanced & Expert Users

How to relay mail to mail server from Unix ?

Hi, I need to send email notifications from Unix/Linux box to users using mailx. In these Unix/Linux boxes mail is not configured however we are having mail server configured in our LAN. Could you please provide instructions to configure relay in these boxes so that we can relay our mails... (3 Replies)
Discussion started by: sourabhsharma
3 Replies

9. HP-UX

[Solved] How do I configure Unix Mail Server to use another Mail Exchange Server

We have configured our mail unix server and can send out emails automatically from applications running on unix to different people in our company as well as outside our company. However there is an outside client who is not receiving these emails because the settings on their mail server cannot... (4 Replies)
Discussion started by: Tenyhwa
4 Replies

10. UNIX for Advanced & Expert Users

How can I send a mail from my outlook or other mail accounts to UNIX server?

Hi all, I want to send a mail for my business needs from outlook account to an unix server (HP-UX) but I don't send any mail. While I can send from the unix server to my outlook account, I can't send from outlook to unix. How can I achieve this ? How can I send a mail from my outlook or other... (2 Replies)
Discussion started by: igelegin
2 Replies
XDG-EMAIL(1)															      XDG-EMAIL(1)

NAME
xdg-email - command line tool for sending mail using the user's preferred e-mail composer SYNOPSIS
xdg-email [--utf8] [--cc address] [--bcc address] [--subject text] [--body text] [--attach file] [mailto-uri address(es)] xdg-email {--help --manual --version} DESCRIPTION
xdg-email opens the user's preferred e-mail composer in order to send a mail to address(es) or mailto-uri. RFC2368 defines mailto: URIs. xdg-email limits support to, cc, subject and body fields in mailto-uri, all other fields are silently ignored. address(es) must follow the syntax of RFC822. Multiple addresses may be provided as separate arguments. All information provided on the command line is used to prefill corresponding fields in the user's e-mail composer. The user will have the opportunity to change any of this information before actually sending the e-mail. xdg-email is for use inside a desktop session only. It is not recommended to use xdg-email as root. See http://portland.freedesktop.org/EmailConfig for information on how the user can change the e-mail composer that is used. OPTIONS
--utf8 Indicates that all command line options that follow are in utf8. Without this option, command line options are expected to be encoded according to locale. If the locale already specifies utf8 this option has no effect. This option does not affect mailto URIs that are passed on the command line. --cc address Specify a recipient to be copied on the e-mail. --bcc address Specify a recipient to be blindly copied on the e-mail. --subject text Specify a subject for the e-mail. --body text Specify a body for the e-mail. Since the user will be able to make changes before actually sending the e-mail, this can be used to provide the user with a template for the e-mail. text may contain linebreaks. --attach file Specify an attachment for the e-mail. file must point to an existing file. Some e-mail applications require the file to remain present after xdg-email returns. --help Show command synopsis. --manual Show this manualpage. --version Show the xdg-utils version information. ENVIRONMENT VARIABLES
xdg-email honours the following environment variables: XDG_UTILS_DEBUG_LEVEL Setting this environment variable to a non-zero numerical value makes xdg-email do more verbose reporting on stderr. Setting a higher value increases the verbosity. EXIT CODES
An exit code of 0 indicates success while a non-zero exit code indicates failure. The following failure codes can be returned: 1 Error in command line syntax. 2 One of the files passed on the command line did not exist. 3 A required tool could not be found. 4 The action failed. 5 No permission to read one of the files passed on the command line. CONFIGURATION
Visit http://portland.freedesktop.org/EmailConfig for information how to configure xdg-email to use the email client of your choice. EXAMPLES
xdg-email 'Jeremy White <jwhite@example.com>' xdg-email --attach /tmp/logo.png --subject 'Logo contest' --body 'Attached you find the logo for the contest.' 'jwhite@example.com' xdg-email --subject 'Your password is about to expire' 'jwhite@example.com' 'bastian@example.com' 'whipple@example.com' AUTHOR
Kevin Krammer, Jeremy White. <kevin.krammer@gmx.at> <jwhite@codeweavers.com> xdg-utils 1.0 06/24/2007 XDG-EMAIL(1)
All times are GMT -4. The time now is 07:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy