Sponsored Content
Full Discussion: mailx on ksh revisited
Top Forums UNIX for Advanced & Expert Users mailx on ksh revisited Post 302124104 by tekline on Thursday 28th of June 2007 05:26:10 PM
Old 06-28-2007
mailx on ksh revisited

I have read through all documents in FAQ and have run into an issue with sending an email with body message text and an email attachment. I have included what I have thus far and I can get the message body to send in the email to work only. I cannot understand the uuencode even after I read the man pages on it. I am using ksh and it seems a bit strange to me why I cannot get this simple task to work. Please help. I can't get past file not found error. Also can someone explain to me in the following:

uuencode [-m] [infile] remote

what remote means exactly. because I just want to uuencode a file that I have on the server that I am working on. It is the only server I know of. And it took a lot of trial and error to figure out the proper sytax to creat the mailx statement because of the <<-EOF put message here (new line)EOF

Thanks for any help you can provide.

#!usr/bin/ksh -p


base= '/usr/local/ol_inv/daily_ETL/test/';
base1= '/usr/local/ol_inv/daily_ETL/test/testfile.txt';
base2= '/usr/local/ol_inv/daily_ETL/test/msgfile.txt';
base3= '/usr/local/ol_inv/daily_ETL/test/combofile.txt';

print "we are sending the message...";


# uuencode ${base}testfile.txt emailattachr2.txt | cat ${base}testfile.txt ${base}msgfile.txt > ${base}combofile.txt
uuencode testfile.txt emailattacher2.txt | cat testfile.txt msgfile.txt > combofile.txt

mailx -s "Online Financial Reporting - New Users" -r "Tim Kline" tim.kline@company.com <<-EOF

~<${base3}


EOF


echo "email was sent!";





>>>command typed at prompt<<<<
$ ksh mail2_ksh.ksh

>>>resulting output<<<<<<<
mail2_ksh.ksh[4]: /usr/local/ol_inv/daily_ETL/test/: 0403-006 Execute permission denied.
/usr/local/ol_inv/daily_ETL/test/testfile.txt: This: not found.
/usr/local/ol_inv/daily_ETL/test/msgfile.txt: This: not found.
/usr/local/ol_inv/daily_ETL/test/combofile.txt: This: not found.
/usr/local/ol_inv/daily_ETL/test/combofile.txt[3]: This: not found.
we are sending the message...
Interpolate what file?
email was sent!


>>>actaul file paths and permissions<<<
$ pwd
/usr/local/ol_inv/daily_ETL/test
$ ls -l

-rwxr--r-- 1 ol_inv whs 1 Jun 28 14:02 attach.txt
-rwxr--r-- 1 ol_inv whs 312 Jun 28 15:40 combofile.txt
-rwxr--r-- 1 ol_inv whs 884 Jun 28 15:40 mail2_ksh.ksh
-rwxrw-r-- 1 ol_inv whs 208 Jun 28 13:53 msgfile.txt
-rwxrwxrwx 1 ol_inv whs 104 Jun 28 13:56 testfile.txt
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

mailx and awk- didn't find an answer KSH

Hi folks, My input file's content: You are line1 You are line2 You are line3 etc... I need to write a script that for every line, it will send an e-mail and the body will hold the line: Output(The e-mail that will be sent): First e-mail: To: aaa Subject: bbb Body:You are line1... (4 Replies)
Discussion started by: hellsd
4 Replies

2. Solaris

ufsrestore, revisited

I just installed solaris 9 on a sunblade 150(sparc), and have it partitioned. I've been using ufsrestore to restore bring the config from my old system, to the sunblade. I'm not having any luck. The root directory restore seems to work. When I try to restore /usr, I get an "/usr/sbin/fsck not... (4 Replies)
Discussion started by: ECBROWN
4 Replies

3. Solaris

ufsrestore revisited,,

in ufsrestore how do i know which volume my selected folder or file exist?. (4 Replies)
Discussion started by: S26+
4 Replies

4. Shell Programming and Scripting

ksh : using mailx and attachments

Hi I want to use mailx command to send a message included more than one file. I tried to use uuencode in pipe but it could only generate one file. I would avoid using an archive file :p Thanks to read you. Mathieu (2 Replies)
Discussion started by: madmat
2 Replies

5. Shell Programming and Scripting

Mailx in shell script (KSH)

Greetings all, I'm pretty new to the use of mailx, having been using mutt most of the time. I'm interested to know how I can use mailx within a shell script to send out a formatted email with the following criterion: 1. My recipient's address is abcdef1000@gmail.com 2. The message body is... (2 Replies)
Discussion started by: rockysfr
2 Replies

6. Virtualization and Cloud Computing

BAM to SOA - Da? Buzzhype Revisited

Many readers have read the hype, experienced the Orwellian marketspeak, watched the positioning debates, and seen poorly managed software companies play the game of analyst-chasing (similar to ambulance chasing when you think about it). Finally, the up-to-date definitions, and hopefully a bit of... (0 Replies)
Discussion started by: Linux Bot
0 Replies

7. Shell Programming and Scripting

mailx: concatenating strings for message body (KSH)

Hi all, Think this is a pretty simple problem, but I've been thinking about it for a few days. Let's say that I'm going to have to output the contents of a file as the body of a mailx message. I'll probably do this: cat <filename> | mailx <extra commands> However, how do I go about doing... (1 Reply)
Discussion started by: rockysfr
1 Replies

8. Solaris

ls display linux style, revisited!!!

hi all, ive downloaded ,built and installed coreutils from sunfreeware.com,in my quest to get the color display when ls is used(linux style)... After the pkg is installed,how do i use ls to get the color? I know its installed because i get a host of cmds that have been updated,l like this, ... (1 Reply)
Discussion started by: wrapster
1 Replies

9. Shell Programming and Scripting

KSH - mailx - Redirect the undelivered mail

Hi, I need to create one KSH which will send mail to set of recipients using "mailx" command like below. mailx -s "Test mail" "test@yahoo.com, test@gmail.com" <$output.txt The recipients are in different domains (like yahoo, gmail, etc.). My requirement is, if any mail is undelivered,... (1 Reply)
Discussion started by: Matrix2682
1 Replies
LR_GETBODY.IN(1)					  LogReport's Lire Documentation					  LR_GETBODY.IN(1)

NAME
lr_getbody - Extract file, sender and subject information from an email SYNOPSIS
eval `lr_getbody [-c content-type] <messagefile>` DESCRIPTION
lr_getbody reads an email message on stdin (or specified as argument), will extract the submitter address and the subject from that email. It will also extract the biggest attachment or the first one having a content-type matching the content-type argument. This information is passed to the caller by printing that information in a format suitable for eval. The following variable will be printed on STDOUT: lr_getbody_SUBMITTER Email address of the submitter. That is the first email that is found in the headers (searched in the following order): Reply-To, From, Sender. This will only contains the address portion (without the <>). lr_getbody_TO The email address to which the email was sent. lr_getbody_SUBJECT Subject of the message. That string is sanitized. lr_getbody_DATE The date of the message. That string is sanitized. lr_getbody_FILE Path to the temporary file holding the found attachment. lr_getbody_OK This will be set if the operation was completed successfully. It is possible for lr_getbody to fail to extract the attachment, but the header information might still be available. This script is used by lr_processmail(1) and lr_rawmail2mail(1). VERSION
$Id: lr_getbody.in,v 1.10 2006/07/23 13:16:33 vanbaal Exp $ COPYRIGHT
Copyright (C) 2002 Stichting LogReport Foundation LogReport@LogReport.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program (see COPYING); if not, check with http://www.gnu.org/copyleft/gpl.html. AUTHOR
Francis J. Lacoste <flacoste@logreport.org> Lire 2.1.1 2006-07-23 LR_GETBODY.IN(1)
All times are GMT -4. The time now is 10:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy