Oh I understand now what is happening. The subject is coming in as three lines. Subject: Tornado Monday, 03/27/2017 at 20:27:02. The Point BB.OBSURGRH is in Alarm at PRI3 with a value of 63.4 %.Informational Text: OB SURGERY HUMIDITY ALARM I'm not getting the second two lines. How "should" one correctly get the subject ??? What I did was in my .procmailrc file SUBJECT=`cat | grep Subject:` So this resulted in only the first line and not grabbing the additional 2 lines. Is there a way to correctly get the subject that I have not found? Thanks for the tips. It led me to the above. Jerry
> Date: Wednesday, April 12, 2017 16:17:38 -0400 > From: Jerry Geis <jerry.geis at gmail.com> > > Oh I understand now what is happening. The subject is coming in as > three lines. > > Subject: Tornado Monday, 03/27/2017 at 20:27:02. The Point > BB.OBSURGRH is in Alarm at PRI3 with a value of 63.4 > %.Informational Text: OB SURGERY HUMIDITY ALARM > > I'm not getting the second two lines. > > How "should" one correctly get the subject ??? > > What I did was in my .procmailrc file > SUBJECT=`cat | grep Subject:` > > So this resulted in only the first line and not grabbing the > additional 2 lines. > Is there a way to correctly get the subject that I have not found? > > Thanks for the tips. It led me to the above. > > JerryThere's supposed to be a "null" line between the structured (header) text lines and the rest of the body. The "Subject:" is generally the last of the structured text lines, so you should be able to start your read with the "Subject:" tag and continue reading until you hit the "null" line.
On Wed, Apr 12, 2017 at 04:17:38PM -0400, Jerry Geis wrote:> Oh I understand now what is happening. The subject is coming in as three > lines. > > Subject: Tornado Monday, 03/27/2017 at 20:27:02. The Point BB.OBSURGRH is > in Alarm at PRI3 with a value of 63.4 %.Informational Text: OB SURGERY > HUMIDITY ALARM > > I'm not getting the second two lines. > > How "should" one correctly get the subject ??? > > What I did was in my .procmailrc file > SUBJECT=`cat | grep Subject:` > > So this resulted in only the first line and not grabbing the additional 2 > lines.are you saying the subject is 3 lines (not one long line that wraps over 3) before you try to send it as email? if so you need to strip out the newlines (or CR/LF) or whatever is there as linebreaks. Have a look at the "tr" command, possibly the -d option. echo "now is the time" | tr -d "\12\15" prints "now is the time" but note that there is no newline at the end of the string, so you'd need to add one back. if you do this, you get the trailing newline, though this looks pretty weird: /usr/bin/echo -e `echo "now is the time" | tr -d "\12\15"` good luck! -- ---- Fred Smith -- fredex at fcshome.stoneham.ma.us ----------------------------- God made him who had no sin to be sin for us, so that in him we might become the righteousness of God." --------------------------- Corinthians 5:21 ---------------------------------
Am 12.04.2017 um 22:24 schrieb Richard: [ ... ]> There's supposed to be a "null" line between the structured (header) > text lines and the rest of the body. The "Subject:" is generally the > last of the structured text lines, so you should be able to start > your read with the "Subject:" tag and continue reading until you hit > the "null" line.No, there is simply no rule nor evidence that the subject header line is or should be the last of all header lines. Typically you see it somewhere within the mail's header. Alexander
On 4/12/2017 4:17 PM, Jerry Geis wrote:> Oh I understand now what is happening. The subject is coming in as three > lines. > > Subject: Tornado Monday, 03/27/2017 at 20:27:02. The Point BB.OBSURGRH is > in Alarm at PRI3 with a value of 63.4 %.Informational Text: OB SURGERY > HUMIDITY ALARM > > I'm not getting the second two lines. > > How "should" one correctly get the subject ??? > > What I did was in my .procmailrc file > SUBJECT=`cat | grep Subject:` > > So this resulted in only the first line and not grabbing the additional 2 > lines. > > Is there a way to correctly get the subject that I have not found?You'll need to grab the line that starts with "Subject:" and then continue grabbing lines until you find one that doesn't start with whitespace. I don't think you can do this with grep, but you should be able to do it with perl, sed, or awk. -- Bowie