htnews  - E-mail robot for adding news items to a webpage.


SYNOPSIS

       htnews [-c | -a configfile]




DESCRIPTION

       With htnews you can very easily add  news  items  to  your
       webpage.  Simply  send an e-mail to it, and htnews will do
       the rest!

       Since it is an e-mail robot, you have to create a  special
       e-mail address and an entry in /etc/aliases. If you do not
       use  sendmail,  refer  to  the   documentation   of   your
       mailserver  about  sending  mail to a program. htnews will
       open a pipe, read the incoming message, and start to  pro-
       cess it.

       For example, if your system uses a virtual user table, add
       a line like this to /etc/virtusertable :
        htnews@foo.bar          robot

       And add a line like this to /etc/aliases (you will have to
       run newaliases afterward) :
        robot:        "|/usr/sbin/htnews"

       Now  you can send an e-mail to htnews@foo.bar, and it will
       be passed through htnews.  The program is  highly  config-
       urable.  See below for a detailed description of available
       configuration flags.


OPTIONS

       -c configfile
              Opens the file configfile, instead of  the  default
              /etc/htnews.conf.   Since  you  can  have  as  many
              e-mail addresses as you want, you can have multiple
              htnews robots running on your system. This is espe-
              cially usefull if you are running  several  virtual
              webservers  or want to provide htnews for your cus-
              tomers as a special service.

       -a configfile
              Run htnews in cron-mode. It will not  open  a  pipe
              for reading an email. htnews can be used to archive
              the news items of the last month with this  option.
              Note, that ARCHIV must be enabled (ARCHIV YES).

       -h --help
              Print  a usage message to standard output then exit
              successfully.

              Print version information to standard  output  then
              exit successfully.



Configuration

       You  can  specify  some  variables  in the configfile,
       which will parsed everytime htnews runs.

       If  you  already  have  some  items  created, and you have
       changed the configuration, then there is a way to force  a
       refresh  of  the output, without putting a new item on the
       page. Simply send an e-mail to  htnews  (the  address  you
       have  configured) with the keyword refresh in the subject.
       htnews will re-read the config-file and recreate the  out-
       put.  Note that ONLY the adminstrator can do this. You can
       specify who that is with the "ADMIN" flag in the  configu-
       ration. See below for details.

       The  format of a flag is as follows: PARAMETER <value>.  A
       parameter and its value must be separated  with  at  least
       one  blank.  The value must be defined without the < and >
       characters used here in this man-page! You can use tabs or
       blanks  as you choose. If you do not want to use a parame-
       ter, simply leave it, or  you  can  delete  the  parameter
       itself.  This  is  only  possible  if the parameter is not
       required! If a parameter is required, it  is  marked  with
       comment.  A  line  beginning with # is a comment. Comments
       and blank lines will be ignored.

   Configuration Flags
       SENDER <e-mail_address>
              Required!  This is the  e-mail  address  of  htnews
              itself.  If  the program has to send an e-mail mes-
              sage (an error or a  delivery  notification),  then
              this  adress will be used in the From: field of the
              mail.

       ADMIN <e-mail_address>
              The server administrator, who will  get  any  error
              messages. If not specified, a default value will be
              used.  This  default  is  defined  in  the   source
              htnews.cc.   It  is not required but recommended to
              have this address and one person who  really  reads
              mail from this box.

       TOsmtp <e-mail_address>
              The  person who will get delivery notifications. If
              not specified, the originator will get the message.
              If  you  set  it to /dev/null , no response message
              will be sent.

       CC <e-mail_address>
              You may specify a filename,  where  you  have  some
              e-mail  addresses  (one  per line) of users who are
              allowed to use (send mail to) the  htnews  program.
              If not specified, everybody can use it.

       Auth_Code <cipher>
              htnews  has  a basic authentication mechanism built
              in. If you specify a password here, the user  would
              have  to  add the password to the subject line of a
              new  mail.  If,  for  example,  the   password   is
              "hucka13",  and the subject you want to use is "New
              update of program bla bla...", then the line in the
              subject  field  must be "hucka13 New update of pro-
              gram bla bla...".
               Of course the password will be parsed before  html
              generation.  It  is  important  that  you leave one
              space after the password. This is required  if  you
              want to use special characters in the subject (like
              german "Umlauts"). Most e-mail clients format these
              characters,  and  any  blanks will be replaced with
              "_". Currently, you cannot use  special  characters
              in  the  subject  field if authentication is turned
              on. But I am working on this.
               If not specified, authentication is disabled.

       TEMPLATE <filename>
              Required!  You must specify a  file  that  will  be
              used  as  a  template  for generating the resulting
              webpage. This can be a normal  html  page.  At  the
              position  where  you  want  htnews  to add the news
              item(s), you must have an html  comment  like  this
              (on one line): <!--htnews--> at this position items
              will be inserted. Note  that  the  output  will  be
              written to a separate file, specified within OUTPUT
              .

       OUTPUT <filename>
              Required!  htnews will write  its  output  to  this
              file. Note that it will be overwritten everytime it
              runs, so do not edit this file; edit  the  template
              instead.

       STORE <filename>
              Required!   htnews will store all old news items in
              this file. A new item will be added to the  top  of
              the file.  The format of this file is a little spe-
              cific, so take a look to your store file to see how
              it  appears.  Note  that the "%<htnews" string is a
              marker for the end of an item.

       UseHTML YES | NO
              It is possible to  send  mime  formatted  mails  to
              in text format and in html format.
               With  the  parameter UseHTML you can choose, which
              of the two parts will be used. If set to "NO" or if
              blank, the text part will be used.

       CRLF YES|NO
              htnews can, if you want,
               "\n"......"<br>"
               "\t"......8 x "&nbsp;"
               more than one " " with n x "&nbsp;"
               This  is  useful,  if  the postings should be dis-
              played like the autor wrote them.
               Note, that it will be turned off, if  the  message
              is already in HTML-format and UseHTML is turned on!

       ITEM_HEAD <html-code>
              You can specify some html code. htnews has  to  add
              this  before inserting the item into the page (e.g.
              "<tr><td>").

       ITEM_FOOT <html-code>
              You can specify some html code. htnews has  to  add
              this  after  inserting the item into the page (e.g.
              "</td></tr>").

       Field1 ... Field4 <fieldname>
              Required!  You can  specify  the  order  that  some
              fields are displayed. One item consists of the fol-
              lowing fields:  Date,  From,  Subject,  Text.   For
              example,  if you want to have Date displayed first,
              then From, and then the Text, you could specify:

               Field1 Date
               Field2 From
               Field3 Text

               You must specify at least ONE  field,  and  it  is
              required to have the "Text" field.

       Mailto YES | NO
              You  can,  if  you  have coosen to display the From
              field, specify how it is to be  displayed.  If  you
              set  Mailto  to  "YES",  then  htnews will create a
              "mailto:" link like this:
               "<A HREF="mailto:user@foo.bar">Real Name</A>".
               If there is no real name found in the from line of
              your  e-mail,  then the e-mail address will be used
              instead. If you set this parameter  to  NO  ,  then
              only the name will be displayed.
               Since  spammers  get  e-mail  addresses especially
              from websites (searched by the "mailto:" tag),  you
              may  find  it  better  not  to  display  an  e-mail

       Date_HEAD and Date_FOOT

       Subject_HEAD and Subject_FOOT

       From_HEAD and From_FOOT

       Text_HEAD and Text_FOOT
              You  may  like to specify what kind of html will be
              inserted BEFORE and AFTER a  specific  field.   For
              example,  if  you  want  to make the Date bold, you
              have to specify "<b>" for Date_HEAD and "</b>"  for
              Date_FOOT.

       SPAMPROTECT YES | NO
              It  is  possible to protect your page against spam-
              mers. htnews can insert blanks into  the  displayed
              address (i.e. "user @ foo.bar").
               A  spammer  cannot  use such an address. Note that
              someone who wants to send an e-mail to  an  address
              prepared this way must edit the address first.


       ARCHIV YES | NO
              If  set  to  YES  ,  all  the following options are
              required. This flag turns  on  the  archive  mecha-
              nisms.  htnews  will only display the N most recent
              messages on the front page. The other (older)  ones
              will  be  displayed  on another page. Of course you
              have to create a link to this page.



       Archiv_Output <filename>
              The html page where htnews will put  the  old  news
              items.
               If  you  want  to  store older items in a separate
              file every month, you can run htnews from  a  cron-
              job!  If  you  di this, you must have the following
              HTML-comment in your archiv-template: <!--cron--> .
               htnews  will insert at this position several links
              to the monthly pages.



       Archiv_Template <filename>
              The template to use for generating the output file.
               Again,  the template must contain a comment, where
              htnews will insert the news items: <!--archiv-->

              Note: htnews will use all flags in htnews.conf  for
              formatting  every  item  field in the archive page.


       Archiv_Store <filename>
              Where  old  news  items  are stored. This file will
              have the same format as your main storage file.


       Archiv_MAXITEMS <number>
              The max N Number of items to be  displayed  on  the
              front page. Only the most recent items will be dis-
              played. Any  older  ones  will  be  stored  in  the
              archive.




       Cron_TEMPL <filename>
              The template to use for generating the monthly out-
              put of the cronjob (htnews -a config-file).
               This   template   can   contain   a   HTML-comment
              <!--title-->.   If this comment exists, htnews will
              insert at this position the title of this page. The
              title will look like this: "May 1999". You can for-
              mat   this   title   with   the   two    parameters
              Archiv_Title_Head    and   Archiv_Title_Foot   (see
              below).



       Cron_OUTPATH <path>
              The complete  unix-PATH  to  the  directory,  where
              htnews  can  store  the  various monthly web-pages.
              htnews must have write permissions to  this  direc-
              tory.  Note,  that the links to these files will be
              without any PATH!
               So, it would be a very good idea, if  this  output
              directory  is the same as the root directory of the
              other HTML-pages.



       Cron_Hist <filename>
              Where should the archiv history  be  saved  to.  (a
              list of filenames).



       Cron_HEAD <html-code> and Cron_FOOT <html-code>
              htnews  will  add  a link to the archiv page to the
              monthly page. With these parameters you can specify
              some HTML-formatting, if you wish.

              <html-code>
              The monthly generated page can have  a  title  with
              the  name  of  the  month  and  the  year. The file
              Cron_TEMPL    must    contain    a    HTML-comment:
              <!--title-->, where htnews will insert the title of
              the monthly page.



       LookDetail YES | NO
              Enable the "detail"-feature. htnews  can  create  a
              separate  web-page for every news item with details
              (like "read more...").
               If enabled, all Detail_* parameters must  be  con-
              figured!
               The program will look for the first occurence of a
              HTML-comment    within    the    incoming     mail:
              <!--detail--> , every stuff after this line will be
              passed to a separate new file.



       Detail_TEMPL <filename>
               The   template   to   use   for   generating   the
              detail-page.  It  can  also contain a HTML-comment:
              <!--title-->, if it occurs, htnews will insert  the
              subject at this position!



       Detail_PATH <PATH>
              The  path  to  the  output directory containing the
              detailpages, it should be the same where the  other
              files are located.
               htnews will generate for every news item (when the
              mail contained the detail-comment) a new  file.  It
              uses the MessageID to create a unique filename! Any
              occurence of "@", "$", "%" or "*" will be  replaced
              with "O".



       Detail_LINK <link name>
              How  the  link  on the news item to the detail-page
              should be named, i.e. "read more...".
               If you specify Subject here, then the  subject  of
              the   item   itself   will   be  the  link  to  the
              detail-page.



       DetailURL <valid URL>
              the detail-file will be created. Note, that Detail-
              PATH and DetailURL must match.
               This URL has to start with http:// or https://. It
              is not required to append a / to the URL,  it  will
              be done automatically, if it is not there.


       Detail_HEAD <html-code> and Detail_FOOT <html-code>
              You  can format the link to the detail-page, if you
              wish.



       again required parameters:
              ""SENDER", "TEMPLATE", "OUTPUT", "STORE",  "Field1"
              (with  minimum one entry and >Text< MUST be there).


Trouble Shooting

       Testing
              It is possible to test  htnews  from  the  command-
              line.  The  source  archiv  contains  a  file named
              fake.mail. This is a complete mail (header and mes-
              sagebody),  the  body  is  in MIME format and it is
              quoted-printable formatted.
               Issue the following command:

               cat fake.mail | htnews -c /where/ever/htnews.conf

               Now see what happens.

       Debugging
              You can view debugging output, if you invoke htnews
              from  the  commandline. You have to compile it with
              --enable-debugging.
               Additional you can use the  provided  script  san-
              ity_check to force a check on you actual configura-
              tion. Refer to  the  file  README.sanity_check  for
              more informations!





       Error messages
              htnews sends small error messages back to the orig-
              inator (or to the person you  have  specified  with
              "TO").  There  are two kinds of messages. The first
              kind is a "delivery" message, sent when  everything
              works  well.  If something goes wrong, you will get
              an error message. htnews will in most cases  detect
              and  "know"  what  was wrong, so the error messages
              will help you find the mistake (or what ever).
              configuration.  Note  that  the  given installation
              procedure is only good for use  with  sendmail.  If
              you  run another smtp server (like qmail, etc.) you
              must refer to the documentation for that server  on
              how to configure it. If someone has experience with
              some other mailservers, please drop me a line, so I
              can add some tips for those users.



Attachments

       Currently,  htnews  can NOT handle attachments! If someone
       sends an attachment to htnews, it will read its data  con-
       tent as ascii data and display it as ascii. If you require
       this feature, please be patient; I am working on this.



Message Formats

       htnews can currently process plain text mail and a sort of
       MIME   messages  (multipart/alternative),  also  known  as
       html-mail. htnews "understands" two MIME-types: text/plain
        and  text/html.   You  can choose, which one of these you
       want to use. If you use the html-part, any occurence of  a
       <body>  -or  <html>-tag  will  be  removed, because it may
       "destroy" the ouptut, which is  HTML  and  which  contains
       already these tags.
        htnews   is  also  capable  of  parsing  quoted-printable
       e-mails. If a message is quoted-printable formatted,  then
       it  will  be  changed  to html. A "=3D" will be changed to
       "=", a "=20" to " "(blank), if after  a  "=20"  a  newline
       follows  it  will be removed, and a "=" foolowed by a new-
       line will be replaced by a "" (nothing) without  the  new-
       line.
        Example:
        <font size=3D2=20
        face=3Darial>
        will be changed to:
        <font size=2 face=arial>

        htnews  cannot  handle  pure  html-mails! Pure HTML-Mails
       will be handeled like plain textmails!
        I have tested it with Netscape Messenger (both  text  and
       text/html),  Outlook  Express, Outlook '97, pine and kmail
       :-)




Security

       Within version 0.6.0 htnews will replace any occurence  of
       a  "`" character with a "'". So it will not be possible to
       let htnews execute any command while it calls sendmail for
       sending  the  response  message back to the originator. In
       earlier releases of htnews, it was possible,  if  one  had
       edit the source of htnews. But I recommend you, NOT to  do
       it! It is dangerous and you cannot trust everybody!



Future Plans

       I  plan to provide a Web interface to htnews. With such an
       interface,  one  could  configure  the  program  from  his
       browser.  And  I  want  to  implement  a  system to handle
       attachments (i.e. converting images to gif, etc.).


Author and download location

       Author Author of htnews is Thomas Linden, tom@daemon.de  ,
              Munich Germany. Drop me a line if you have any com-
              ments or questions.

       Download location
              http://uss.cybernet-ag.net/~tlinden/
               or ftp.daemon.de/pub/utils/htnews.tar.gz



Credits

       Very special thanks to Jeff W. Bizzaro, who has  corrected
       many mistakes in the man-page. With his help, it is "nice"
       english. Thanks a lot, Jeff!
        Also thanks to all the people, who have reported bugs and
       who have requested some additional features.




Copyright

       htnews  is  published  under  the terms of the GNU General
       Public License. If you are  running  an  operating  system
       like Linux or BSD, you should already have a local copy of
       the   document.   If   not,   you   can   read    it    at
       http://www.gnu.org/


















Man(1) output converted with man2html