SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Sun May 19, 2024 20:27
SMSTools3 Community » Help and support Bottom

[answered] How to convert HTML email to clear TEXT

  This topic is locked

Page:  1

Author Post
Member
Registered:
May 2009
Location: Hinnerup, Denmark
Hi,

Im using the email2sms script, and it works fine using clear ype/text email when sending an email to my sms server.

But i would like a script to convert the HTML email to an clear type/text email, is it possible to include the script in my email2sms script, and how do make the scipt ?

Please help :D

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
You can use the script like this:

TMPFILE=$(mktemp /tmp/smsgw.out.XXXXXX)
cat >$TMPFILE

TMPFILE2=$(mktemp /tmp/smsgw.out.XXXXXX)
sed -r "s/(<[^>]+>)//g" < $TMPFILE | \
        sed "s/&lt;/</g" | \
        sed "s/&gt;/>/g" | \
        sed "s/&nbsp;/ /g" | \
        sed "s/&amp;/&/g" > $TMPFILE2
rm $TMPFILE

OUTFILE=$(mktemp /var/spool/sms/outgoing/smsgw.out.XXXXXX)
mv $TMPFILE2 $OUTFILE
echo "SMS queued to $OUTFILE"
'bash' Syntax Highlight powered by GeSHi


With sed all html tags are removed and some character entities are replaced by the relevant characters.

This is just an example and does not include all possible conversions which may be required.

By searching on Google "strip html regular expression" you can find more information.

Member
Registered:
May 2009
Location: Hinnerup, Denmark
Topic owner
Hi keke

Okay, i will try this a soon a possible, thanks :mrgreen:

Regards
//WolfieDK

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.