Sponsored Content
Top Forums Shell Programming and Scripting bash dump raw email body txt from Maildir Post 302578146 by unclecameron on Thursday 1st of December 2011 01:44:24 AM
Old 12-01-2011
bash dump raw email body txt from Maildir

I'm setting up a cronjob that will hopefully dump the contents of a email delivered to Maildir/new/ to /home/user/raw.txt (and then delete that email)

I could manually remove the bottom line of the raw email, then place the contents in the next line up in the /home/user/raw.txt, but it seems to me there's probably a more elegant way to script mutt to do it (which would also parse html email if the user forgot), or mail/pine/whatever, plus raw sed/awk/whatever wouldn't seem to be very error tolerant, is there a better way to do this? This is for an automated weather report I want to push to a website via a junk email account I've created on the webserver (that part is working fine).

I guess if I could figure out how to get procmail to do it directly, that'd work too. Right now I'm using (in postfix)
Code:
mailbox_command = /usr/bin/procmail -a "$EXTENSION" DEFAULT=$HOME/Maildir/ MAILDIR=$HOME/Maildir


Last edited by unclecameron; 12-01-2011 at 02:52 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to check body of the email

Dears, i have user called dellsh i hope to make this script when this user recieve email check the budy of the email about (StatusRequest) when i find this email contain this subject run crontab do this job (create file in my home directory called index) thanks for your attention (1 Reply)
Discussion started by: dellsh
1 Replies

2. Shell Programming and Scripting

Please suggest how do i dump in .txt

I have requirement where i need to read data from .sh file. I am using awk to identify the particualr data and extracting it. mY CODE : awk '/SELECT/,/;/' SOURCE.sh I am getting output as SELECT.... .... FROM TABLE1; SELECT.... .... FROM TABLE2; SELECT.... .... FROM TABLE3; But my... (0 Replies)
Discussion started by: goutam_igate
0 Replies

3. Shell Programming and Scripting

emailing as body of email

hi all, how do i email a file in the body of an email rather than as an attachment ?? have a ksh script which i need to read a file and email as part of the body rather than an attachment. my code is : uuencode file.log | mailx -s "test" but this sends file as an attachment. ... (2 Replies)
Discussion started by: cesarNZ
2 Replies

4. Shell Programming and Scripting

The body of the Email -- mailx

Hi, I am using mailx command to send an email and i took the body of the email from a file, mailx -r gtt.org -s "Status Report " ss@org.com < $ProcessStatisticsFile but now i want to declare the body of the email in the command itself. I have tried with the following command but... (4 Replies)
Discussion started by: chinnu01
4 Replies

5. Shell Programming and Scripting

Crontab issue: getting email but with out body

I have a oracle sh script test.sh #!/bin/bash R=`sqlplus -S *****/*********@dfsdf <<ENDOFSQL set serveroutput on size unlimited; execute DBMS_SNAPSHOT.REFRESH( '"MIS_ADMIN"."MV_SURVEY_UNITS_CENSUS"','F'); execute DBMS_SNAPSHOT.REFRESH( '"MIS_ADMIN"."MV_SURVEY_UNITS_CENSUS_PART"','F');... (1 Reply)
Discussion started by: ramkia6
1 Replies

6. Shell Programming and Scripting

issue with Email Body

Hi, I have written shell program to send email as below - #!/bin/ksh filename=`ls -ltrh *.Z` echo $filename |mailx -s "FOR TESTING" rahul.b@infotech.net I am getting the email but email body is - -rw-rw-r-- 1 bahulra dba 173M Mar 22 04:37 corphist.txt.Z -rw-rw-r-- 1 bahulra dba 107M... (3 Replies)
Discussion started by: rahulbahulekar
3 Replies

7. Shell Programming and Scripting

awk print the body of an email

I have fetched a couple of emails and stored then in /fetch/mail/oracle.txt, the displayed content is Date: From: Subject: To: Content-Type: ---body ----- --------- Date: From: Subject: To: Content-Type: ----body ----- ------ Date: From: I want to retrieve the body only from... (3 Replies)
Discussion started by: maddog21
3 Replies

8. UNIX for Dummies Questions & Answers

Sending mail in UNIX with body and attachment(.txt) using sendmail command

Hi All, In my .ksh script, I am sending an email with body and attachment (.txt) using sendmail command. I am able to receive the attachement along with the body of the mail. But I am getting special characters along with the content in the .txt. Also the alignment is incorrect. Can you please... (7 Replies)
Discussion started by: KRR
7 Replies

9. Shell Programming and Scripting

Need special charecter in email body

I have a unix shell script generate.sh that writes to a file hello.txt using redirect. For example:echo " Today's report shows progress by: " > hello.txt This hello.txt is then send as an email body to the recipients. My requirement is to have this special characters(up arrow and down arrow... (6 Replies)
Discussion started by: mohtashims
6 Replies

10. UNIX for Beginners Questions & Answers

Not able to generate table in email body

Below is the code snippet and I'm not able to generate the table in email, output email has nothing if ; then echo "File $fName exists." awk -F "," ' BEGIN { print "MIME-Version: 1.0" print "Content-Type: text/html" print "Subject: Out OF Network Fee - Portfolio Level Stats" print... (1 Reply)
Discussion started by: vyomdev
1 Replies
checkapoppw(8)						      System Manager's Manual						    checkapoppw(8)

NAME
checkapoppw - checks APOP password against the file ~/Maildir/.password SYNOPSIS
checkapoppw prog DESCRIPTION
checkapoppw reads descriptor 3 through end of file and then closes descriptor 3. There must be at most 512 bytes of data before end of file. The information supplied on descriptor 3 is a login name terminated by , a password terminated by , a timestamp terminated by , and possibly more data. There are no other restrictions on the form of the login name, password, and timestamp. If the password is unacceptable, checkapoppw exits 1. If checkapoppw is misused, it may instead exit 2. If there is a temporary problem checking the password, checkapoppw exits 111. If the password is acceptable, checkapoppw runs prog. prog consists of one or more arguments. Compatible tools There are other tools that offer the same interface as checkapoppw Note that these tools do not follow the getopt interface. Optional features are controlled through (1) the tool name and (2) environment variables. The password database checkapoppw checks the APOP password against the content of the file Maildir/.password (not encrypted) in the user's home directory corre- sponding to the login name. Maildir may be overidden through the environment variable $MAILDIR. Process-state changes Before invoking prog, checkapoppw sets up $USER, $HOME, $SHELL, its supplementary groups, its gid, its uid, and its working directory. FILES
~/Maildir/.password SEE ALSO
checkpw(8), qmail-popup(8), qmail-pop3d(8) AUTHOR
This manual page was written by Gerrit Pape <pape@smarden.org>, for the Debian GNU/Linux system. checkapoppw(8)
All times are GMT -4. The time now is 03:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy