Now the emails will automatically be piped into the process as they arrive.
Then add something similar to:
Code:
#!/usr/bin/bash
subject1=" Email job submission status"
subject2=" Fax job status - Conversion Failure"
subject3=" Fax Status for Job ID"
first=0
start=0
JOBSTATUS=; export JOBSTATUS
SPOOLID=; export SPOOLID
DATETIME=; export DATETIME
PAGES=; export PAGES
STATUS=; export STATUS
TOTTIME=; export TOTTIME
#
while read line
do
if [ $first -eq 0 ]
then
first=1
from=`echo $line |cut -d" " -f2 `
if [ "$from" != "support@faxage.com" ]
then
echo not from faxage
exit
fi
fi
line1=${line/:/_}
key=`echo $line1|cut -d"_" -f1`
value=`echo $line1|cut -d"_" -f2`
value=`echo "$value"`
if [ "a$value" = "a" ]
then
continue
fi
if [ "a$key" != "aSubject" -a $start -eq 0 ]
then
continue
fi
if [ "a$key" = "aSubject" ]
then
start=1
if [ "a${value:0:${#subject1}}" = "a$subject1" ]
then
JOBSTATUS="QUEUED"
continue
fi
if [ "a${value:0:${#subject2}}" = "a$subject2" ]
then
JOBSTATUS="ERROR"
continue
fi
if [ "a${value:0:${#subject3}}" = "a$subject3" ]
then
JOBSTATUS="OK"
continue
fi
fi
if [ "$key" = "CustID" ]
then
SPOOLID=$value
fi
if [ "$key" = "Status" ]
then
STATUS=`echo $value`
fi
if [ "$key" = "Finished At" ]
then
DATETIME=`echo $value`
DATETIME=${DATETIME:0:10}${DATETIME:11:8}${DATETIME:20:7}
fi
if [ "$key" = "Transmit Time" ]
then
TOTTIME=`echo $value`
fi
if [ "$key" = "Page Count" ]
then
PAGES=`echo $value`
fi
done
echo JOBSTATUS=$JOBSTATUS >>/u2/fax/faxage.log
echo SPOOLID=$SPOOLID >>/u2/fax/faxage.log
echo STATUS=$STATUS >>/u2/fax/faxage.log
echo PAGES=$PAGES >>/u2/fax/faxage.log
echo DATETIME=$DATETIME >>/u2/fax/faxage.log
echo TOTTIME=$TOTTIME >>/u2/fax/faxage.log
given an email that looks like:
Code:
From support@faxage.com Tue Oct 18 13:47:58 2016
Message-Id: <201610up.com>
Received: from [6.199]
for <faxout@p.com>; Tue, 18 Oct 2016 11:47:51 -0600 (MDT)
Content-Type: multipart/mixed; boundary="_----------=_1476812871189590"
MIME-Version: 1.0
X-Mailer: MIME::Lite 3.029 (F2.78; T1.35; A2.12; B3.08; Q3.08)
Date: Tue, 18 Oct 2016 11:47:51 -0600
From: "FAXAGE" <support@faxage.com>
To: "Canada Inc" <faxout@p.com>
Subject: Fax Status for Job ID 289215564 to (819)555-1212
X-Faxage-Status: Failure
upportontent-Transfer-Encoding: 7bit
This is a multi-part message in MIME format.
--_----------=_1476812871189590
Content-Disposition: inline
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Your fax job has completed. Details are below:
To: Email to FAX
Number: (819)555-1212
Status: Failure
Reason: No Answer
Finished At: 2016-10-18 13:47:49 EDT
Transmit Time: 00:00:16
Pages Sent: 0
CustID:999999
--_----------=_1476812871189590--
I've written a a script which generates a report file, saved to a unix directory. I need to transfer it, via email, to some users. The command I'm using in my script is:
(note that subject & cur_address are set in the script prior to this line)
cat /u/sandyl/sm_o_commdt_archive/c | uuencode... (3 Replies)
I've written a a script which generates a report file, saved to a unix directory. I need to transfer it, via email, to some users. The command I'm using in my script is:
(note that subject & cur_address are set in the script prior to this line)
cat /u/sandyl/sm_o_commdt_archive/c | uuencode... (3 Replies)
We have been trying to get an email from unix to Lotus Notes to work. We finally got it to work with the following code:
cat filename | uuencode filename | mailx -s "subject title" email address
Now our problem is that Lotus Notes doesn't show the paper clip icon, indicating an attachment... (3 Replies)
Hi all,
I have searched the FAQ and find that there is some threads related to this subject.
But can you please give an examples on how to send attachment to Lotus Notes email through UNIX?
Since i have gone through the RFC and the URL. But i still have no idea on it.
Please give some... (7 Replies)
Hello All,
This is a common question that I found lot of results in the forums.
I am trying to use uuencode to attach a file and send email. I have no issues sending email, but not able to attach any files using sendmail.
Is uuencode part of sendmail or does 'uuencode' utility need to be... (1 Reply)
Hi,
I have a shell script which send email with an attachment in the form of an email. However, the when I open the attachment, all the data comes in one column. How do I format the data in the excel sheet while sending the email?
Thanks (8 Replies)
I am using the following command to send PDF attachment with a mail.
uuencode <attachment.pdf> <attachment.pdf>|mailx -s <subject> <mail_id> < <Message_file.txt>
This one send the message with attachment. I would like send PDF attachment with the mail
Can any one help with this issue ?
... (0 Replies)
Hi,
I have a syntax for mail attachment as
$EMAIL "Wrapper $wrapper_script_name has failed" " $wrapper_script_name has Failed " $failed_email_address
and $EMAIL is as below
MSGSub=${1}
MSGText=${2}
RMAIL=${3}
#set LANG=''
export LANG=''
echo "${MSGSub}" | mailx -s "${MSGText}" ... (1 Reply)
Team,
I have the below code, which is working fine and it sends the html report using sendmail command.
I want to attach one more file ( which goes as attachment ) in that email. How to achieve it.
i tried with uuencode. But no luck :mad:
outputFile="/tmp/out.html"
(
echo... (2 Replies)
Hello everyone,
So, here is my requirement.
I want to run an SQL query and export the result in an excel file and send that as an attachement in an email to the intended receipients.
Please help me understand how to do that.
How to connect to database, how to export the output in an excel... (3 Replies)