[CentOS] email subject length issue

Fred Smith fredex at fcshome.stoneham.ma.us
Wed Apr 12 20:46:22 UTC 2017


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 ---------------------------------



More information about the CentOS mailing list