- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Garbage 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
Discussions
Discussions
Forums
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
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
тАО04-18-2007 04:28 AM
тАО04-18-2007 04:28 AM
Garbage using sendmail
I am writing a script to send, through sendmail, a Ascii file to certain people. Here is the script:
SENDMAIL=/usr/sbin/sendmail
UUENCODE=/usr/bin/uuencode
USER_LIST="garvin"
DOMAIN=my.domain.com
LOG_FILE=/var/log/messages
#
for USER in $USER_LIST
#
do
#
echo "Subject: Output Log $0 \n` cat $LOG_FILE | $UUENCODE $LOG_FILE`" | $SENDMAIL $USER@$DOMAIN
#
done
I can receive the email but:
1. "To" line shows 'undisclosed-recipients:;
2. "Subject" line shows ./send2.test (this is the name of the script I am running) then \nbegin 644 /var/log/messages
3. As far as what is to be attached... comes up M07!R(#$Q(#`T.C$U.C$Y('1H;V]S83$@
This isn't all but you get the idea.
As you can see from the script we are using sendmail and postfix is the engine underneath
If possible I don't wish to use mutt or anything else. This script works well in HPUX
but what's the big difference in SLES 9?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-18-2007 05:16 AM
тАО04-18-2007 05:16 AM
Re: Garbage using sendmail
Not the best question for an HP-UX forum?
"man sendmail" may show its command-line
options. The "sendmail" program itself and
its configuration tend to differ among
different systems.
The stuff with "M" at the beginning of each
line is what you get out of "uuencode".
What's your complaint about that?
On HP-UX, I'd tend to use "mailx" instead of
"sendmail" for this sort of thing, but many
things are possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-18-2007 05:38 AM
тАО04-18-2007 05:38 AM
Re: Garbage using sendmail
If you are using an stmp relay it could be making your mail into garbage.
Otherwise compare your script to a production working script and see if there is something that helps.
http://www.hpux.ws/mailfile1
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
тАО04-18-2007 05:45 AM
тАО04-18-2007 05:45 AM
Re: Garbage using sendmail
The url you have sent does not work. I received:
Not Found
The requested URL /mailfile1 was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Does it work on your end?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-19-2007 07:27 AM
тАО04-19-2007 07:27 AM
Re: Garbage using sendmail
Perhaps this helps:
#!/bin/sh
SENDMAIL=/usr/sbin/sendmail
UUENCODE=/usr/bin/uuencode
USER_LIST="garvin"
DOMAIN=my.domain.com
LOG_FILE=/var/log/messages
#
for USER in $USER_LIST
do
{ echo "Subject: Output Log $0"
echo "To: $USER@$DOMAIN"
cat $LOG_FILE | $UUENCODE $LOG_FILE
} | $SENDMAIL -t
done
#------------------------------------
It might be better not to uuencode the message and rather settle for a more detailed mail header and files which have been processed a bit in advance.
Here is some lines to study and give some ideas...
#-----------------------------------------
BODYTXT="/tmp/mailbody.$$"
CSVREPOT="/tmp/report.$$"
#
# some script to generate mailbody and CSV report files
#
# Then send the mail with the CSV report as attachment named "datasheet.csv"
echo "Subject: My Subject"
echo "To: $RECIPIENTS "
echo "Reply-To: $REPLYTO"
echo "Mime-Version: 1.0"
echo "Content-Type: multipart/mixed; boundary=\"boundary-line\""
echo "\nThis is a MIME multipart mail message.\n"
echo "--boundary-line"
echo "Content-Type: text/html; charset=us-ascii\n"
cat -v $NOTTXT
echo "\n--boundary-line"
echo "Content-Type: application/ms-excel;"
echo " name=\"datasheet.csv\""
echo "Content-Transfer-Encoding: us-ascii"
echo "Content-Disposition: attachment;"
echo " filename=\"datasheet.csv\"\n"
sleep 1
cat -v $REPFILE
} | sendmail -t
#----------------------------------------
Some more lines if you would like to pipe to a notification script
#! /bin/sh
# Script to forward mail with sendmail
#
# How it works:
# This script will use the parameters to define subject and recipients.
# All standard input will be added as mailbody
# The mail is sent by user: sysadmin
#
# Usage: notify {your subject} : {comma separated recipients}
LINE="$*"
SUBJECT="$(echo "${LINE}"|cut -d: -f1)"
RECIPIENTS="$(echo "${LINE}"|cut -d: -f2)"
# Send mail to specified recipient
{ echo "Subject: $SUBJECT"
echo "To: $RECIPIENTS "
echo "Reply-To: sysadmin@my.domain"
echo 'MIME-Version: 1.0'
echo 'Content-Type: text/html; charset=us-ascii'
cat
} | su - sysadmin -c "sendmail -t" 1>/dev/null 2>&1
# ---------------------------------
Hope this helps
/Tor-Arne