Sponsored Content
Top Forums Shell Programming and Scripting bash dump raw email body txt from Maildir Post 302578442 by unclecameron on Thursday 1st of December 2011 01:27:29 PM
Old 12-01-2011
cat /home/user/Maildir/new/1322721060.6211_0.www
Code:
Return-Path: <user1@blah.com>
X-Original-To: blah@blah.com
Delivered-To: blah@blah.com
Received: from smtp178.blah.com (smtp178.blah.com [207.97.245.178])
    by hostname.com (Postfix) with ESMTPS id C10893DD2F
    for <blah@blah.com>; Wed, 30 Nov 2011 22:30:59 -0800 (PST)
Received: from smtp27.blah.com (localhost.localdomain [127.0.0.1])
    by smtp27.blah.com (SMTP Server) with ESMTP id 04736118FC4
    for <blah@blah.com>; Thu,  1 Dec 2011 01:30:54 -0500 (EST)
X-SMTPDoctor-Processed: csmtpprox 2.7.4
Received: from localhost (localhost.localdomain [127.0.0.1])
    by smtp27.blahcom (SMTP Server) with ESMTP id F3BCC118FC5
    for <blah@blah.com>; Thu,  1 Dec 2011 01:30:53 -0500 (EST)
X-Virus-Scanned: OK
Received: by smtp27.blah.com (Authenticated sender: blah-AT-blah.com) with ESMTPSA id 78556118FC4
    for <blah@user.com>; Thu,  1 Dec 2011 01:30:53 -0500 (EST)
From: "blah <blah1@user.com>
To: <blah@user.com>
Subject: test4
Date: Wed, 30 Nov 2011 22:30:52 -0800
Message-ID: <00bc01ccaff2$c6b88670$54299350$@com>
MIME-Version: 1.0
Content-Type: text/plain;
    charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: Acyv8sWFTCt6aRGGS22J2iL97tXyVw==
Content-Language: en-us

This is the text I need, it may possibly span two lines or more
but it will always have a blank line above and below it.

the closing code tag truncated the blank line after the text I need, but it's really there.

I keep thinking mailx/mutt should somehow be able to dump the body to something.txt, I just can't seem to figure out how.
 

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
ICONV_MIME_DECODE_HEADERS(3)						 1					      ICONV_MIME_DECODE_HEADERS(3)

iconv_mime_decode_headers - Decodes multiple MIMEheader fields at once

SYNOPSIS
array iconv_mime_decode_headers (string $encoded_headers, [int $mode], [string $charset = ini_get("iconv.internal_encoding")]) DESCRIPTION
Decodes multiple MIME header fields at once. PARAMETERS
o $encoded_headers - The encoded headers, as a string. o $mode -$mode determines the behaviour in the event iconv_mime_decode_headers(3) encounters a malformed MIME header field. You can spec- ify any combination of the following bitmasks. Bitmasks acceptable to iconv_mime_decode_headers(3) +------+--------------------------------------+---+ |Value | | | | | | | | | Constant | | | | | | | | Description | | | | | | +------+--------------------------------------+---+ | 1 | | | | | | | | | ICONV_MIME_DECODE_STRICT | | | | | | | | If set, the given header is decoded | | | | in full conformance with the stan- | | | | dards defined in RFC2047. This | | | | option is disabled by default | | | | because there are a lot of broken | | | | mail user agents that don't follow | | | | the specification and don't produce | | | | correct MIME headers. | | | | | | | 2 | | | | | | | | | ICONV_MIME_DECODE_CONTINUE_ON_ERROR | | | | | | | | If set, iconv_mime_decode_head- | | | | ers(3) attempts to ignore any gram- | | | | matical errors and continue to | | | | process a given header. | | | | | | +------+--------------------------------------+---+ o $charset - The optional $charset parameter specifies the character set to represent the result by. If omitted, iconv.internal_encoding will be used. RETURN VALUES
Returns an associative array that holds a whole set of MIME header fields specified by $encoded_headers on success, or FALSE if an error occurs during the decoding. Each key of the return value represents an individual field name and the corresponding element represents a field value. If more than one field of the same name are present, iconv_mime_decode_headers(3) automatically incorporates them into a numerically indexed array in the order of occurrence. EXAMPLES
Example #1 iconv_mime_decode_headers(3) example <?php $headers_string = <<<EOF Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?= To: example@example.com Date: Thu, 1 Jan 1970 00:00:00 +0000 Message-Id: <example@example.com> Received: from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com) Received: (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000 EOF; $headers = iconv_mime_decode_headers($headers_string, 0, "ISO-8859-1"); print_r($headers); ?> The above example will output: Array ( [Subject] => Prufung Prufung [To] => example@example.com [Date] => Thu, 1 Jan 1970 00:00:00 +0000 [Message-Id] => <example@example.com> [Received] => Array ( [0] => from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com) [1] => (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000 ) ) SEE ALSO
iconv_mime_decode(3), mb_decode_mimeheader(3), imap_mime_header_decode(3), imap_base64(3), imap_qprint(3). PHP Documentation Group ICONV_MIME_DECODE_HEADERS(3)
All times are GMT -4. The time now is 06:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy