|
From: Ken C. <kco...@ry...> - 2013-01-25 14:01:09
|
Jeremy,
Thanks for writing all that up. I forgot about the SCRIPT tag....
I'll give it a go.
Ken Connell
Intermediate Network Engineer
Computer & Communication Services
Ryerson University
350 Victoria St
RM PODB50
Toronto, Ont
M5B 2K3
416-979-5000 x6709
On 2013-01-24 10:10 PM, "Jeremy Laidman" <jla...@re...> wrote:
> To do this, define your alert with a SCRIPT method specifying your custom
> script that does what you need. The "what you need" bit depends on whether
> you're trying to clean up the email to make it readable in plain text, or
> to wrap the email so that it displays correct HTML in the recipient's mail
> client. The script might look like this:
>
> #!/bin/sh
> RECIP="$1"
> TMPFILE=`mktemp`
> cat > $TMPFILE
> if grep "</table>" >/dev/null; then
> { echo "Subject: message from Xymon"
> echo "Content-type: text/html"
> echo ""
> cat $TMPFILE
> } | $MAIL $RECIP
> else
> cat $TMPFILE | $MAIL $RECIP
> fi
>
> This script detects a "</table>" tag and then inserts a header that might
> tell the recipient's mail client that the message is in HTML format.
> Messages without tables will go through untouched. I suspect there's a
> bit more to get the messages in the correct format (might also need to add
> from, to and date headers) as well as adding the correct MIME headers.
> It's been a while since I did this type of thing and I have no examples to
> look at. But this can probably get you started.
>
> If you wanted to strip out all of the HTML and make it a readable table in
> a text-only message then the middle bit might instead look like this:
>
> { echo "Subject: message from Xymon"
> echo "Content-type: text/html"
> echo ""
> sed 's/<[^>]*>//g' $TMPFILE
> } | $MAIL $RECIP
>
>
> J
>
>
>
> On 25 January 2013 12:10, Ken Connell <kco...@ry...> wrote:
>
> > Not sure how I'd go about that....But I see what you mean. Thanks for the
> > reply.
> >
> > Ken Connell
> > Intermediate Network Engineer
> > Computer & Communication Services
> > Ryerson University
> > 350 Victoria St
> > RM PODB50
> > Toronto, Ont
> > M5B 2K3
> > 416-979-5000 x6709
> > On 2013-01-24 8:04 PM, "Jeremy Laidman" <jla...@re...>
> wrote:
> >
> > > I saw both emails. Yes it's a bit disconcerting when you don't see
> your
> > > own post. I think your problem is not easy to solve. Perhaps you
> could
> > > have a custom mailer that reformats the email the way you want.
> > >
> > > J
> > >
> > >
> > >
> > > On 24 January 2013 11:41, Ken Connell <kco...@ry...> wrote:
> > >
> > > > Sorry if this is a double post.... I never seen the email bounce back
> > via
> > > > the list so I think my first attempt failed....
> > > >
> > > > Is there any way to send nicely formatted emails from tests that are
> > > built
> > > > via "TABLES".
> > > >
> > > > Example email of temperature alert/email on an Avaya stack:
> > > >
> > > > <table border=1 cellpadding=5>
> > > > <tr><td>Unit Temperature</td></tr>
> > > > <tr><td>&red 50.50</td></tr>
> > > > <tr><td>&yellow 48.00</td></tr>
> > > > <tr><td>&yellow 49.00</td></tr>
> > > > <tr><td>&yellow 47.00</td></tr>
> > > > <tr><td>&yellow 48.00</td></tr>
> > > > <tr><td>&green 45.00</td></tr>
> > > > <tr><td>&green 45.00</td></tr>
> > > > </table>
> > > >
> > > > Ken Connell
> > > > Intermediate Network Engineer
> > > > Computer & Communication Services
> > > > Ryerson University
> > > > 350 Victoria St
> > > > RM PODB50
> > > > Toronto, Ont
> > > > M5B 2K3
> > > > 416-979-5000 x6709
> > > >
> > > >
> > >
> >
> ------------------------------------------------------------------------------
> > > > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> > > > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills
> current
> > > > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> > > > MVPs and experts. ON SALE this month only -- learn more at:
> > > > http://p.sf.net/sfu/learnnow-d2d
> > > > _______________________________________________
> > > > Devmon-support mailing list
> > > > Dev...@li...
> > > > https://lists.sourceforge.net/lists/listinfo/devmon-support
> > > >
> > >
> > >
> >
> ------------------------------------------------------------------------------
> > > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> > > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> > > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> > > MVPs and experts. ON SALE this month only -- learn more at:
> > > http://p.sf.net/sfu/learnnow-d2d
> > > _______________________________________________
> > > Devmon-support mailing list
> > > Dev...@li...
> > > https://lists.sourceforge.net/lists/listinfo/devmon-support
> > >
> >
> >
> ------------------------------------------------------------------------------
> > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> > MVPs and experts. ON SALE this month only -- learn more at:
> > http://p.sf.net/sfu/learnnow-d2d
> > _______________________________________________
> > Devmon-support mailing list
> > Dev...@li...
> > https://lists.sourceforge.net/lists/listinfo/devmon-support
> >
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnnow-d2d
> _______________________________________________
> Devmon-support mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/devmon-support
>
|