HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] Attachment to fax send conformation



Pedro Rocadas schrieb:
> --- Ilia Shapira <Ilia@tiltan-se.co.il> wrote:
> 
>>Currently when a user send a fax he receives an
>>email after the fax is sent
>>that tells him that the fax was sent ok etc.
>>
>>Is it possible to configure Hylafax to send with
>>this email attachment that
>>will include the sanded fax as PDF or something like
>>that?
>>
> 
> 
> Yes. Mailling list is your friend ;-).
> 
> http://www.hylafax.org/archive/2003-06/msg00190.php

Hello Pedro,
hello Mailinglist,

I tried the script. But I get Error-eMails like this:


A message that you sent contained no recipient addresses, and therefore no
delivery could be attempted.

------ This is a copy of your message, including all the headers. ------

Received: from uucp by gustav with local (Exim 3.35 #1 (Debian))
	id 19YPOe-0006B5-00; Fri, 04 Jul 2003 14:10:36 +0200
Message-Id: <E19YPOe-0006B5-00@gustav>
From: uucp <uucp@gustav.duck>
Date: Fri, 04 Jul 2003 14:10:36 +0200

Sorry, there was a problem sending notification;
something went wrong in the shell script bin/notify.


What´s wrong?


Thank you!


Gerhard


P. S.

Here´s the notify.awk - script:

function printItem(fmt, tag, value)
{
     printf "%14s: " fmt "\n", tag, value;
}

function printBanner(banner)
{
     print "";
     print "    ---- " banner " ----";
     print "";
}

function docType(s)
{
     if (match(s, "\.cover"))
      return "PostScript cover page";
     else if (match(s, "\.ps"))
      return "PostScript";
     else if (match(s, "\.tif"))
      return "TIFF";
     else if (match(s, "\.pcl"))
      return "PCL";
     else
      return "Unknown document type";
}

#
# Construct a return-to-sender message.
#
function returnToSender()
{
     printBanner("Unsent job status");
     printItem("%s", "Destination", number);
     printItem("%s", "JobID", jobid);
     printItem("%s", "GroupID", groupid);
     printItem("%s", "Sender", sender);
     printItem("%s", "Mailaddr", mailaddr);
     if (commid != "")
      printItem("%s", "CommID", commid);
     if (modem != "any")
      printItem("%s", "Modem", modem);
     printItem("%s", "Submitted From", client);
     if (jobType == "facsimile") {
      printItem("%u (mm)", "Page Width", pagewidth);
      printItem("%.0f (mm)", "Page length", pagelength);
      printItem("%.0f (lpi)", "Resolution", resolution);
     }
     printItem("%s", "Status", status == "" ? "  (nothing available)" :
status);
     printItem("%u (exchanges with remote device)", "Dialogues", tottries);
     printItem("%u (consecutive failed calls to destination)", "Dials",
ndials);
     printItem("%u (total phone calls placed)", "Calls", totdials);
     if (jobType == "facsimile") {
         printItem("%u (pages transmitted)", "Pages", npages);
      printItem("%u (total pages to transmit))", "TotPages", totpages);
      printItem("%u (attempts to send current page)", "Attempts", ntries);
      } else if (jobType == "pager") {
      if (npins != 0) {
          printBanner("Unsent pages submitted for transmission");
          for (i = 0; i &lt; npins; i++)
           printf "%15s\n",  "PIN " pins[i];
      }
      if (nfiles != 0) {
          printBanner("Message text");
          while ((getline &lt;files[0]) &gt; 0)
           print $0;
          close(files[0]);
      }
     }
}

function returnTranscript()
{
     printBanner("Transcript of session follows");
     comFile = "log/c" commid;
     if ((getline &lt;comFile) &gt; 0) {
      do {
          if (index($0, "-- data") == 0)
           print $0
      } while ((getline &lt;comFile) &gt; 0);
      close(comFile);
     } else {
      printf "    No transcript available";
      if (commid != "")
          printf "(CommID c" commid ")";
      print ".";
     }
}

function printStatus(s)
{
     if (s == "")
      print "&lt;no reason recorded&gt;";
     else
      print s
}

function putHeaders(subject)
{
     print "MIME-Version: 1.0";
     print "Content-Type: multipart/mixed;";
     print "    boundary=\"----=_NextPart_000_0012_01BF3CD4.528144C0\"";
#
# Uncomment and change to your domain if using smbfax and winbind
#    sub(/DOMAIN\+./,"",mailaddr);
#
     print "To: " mailaddr;
     print "Subject: " subject;
     print "";
     print "This is a multi-part message in MIME format.";
     print "";
     print "------=_NextPart_000_0012_01BF3CD4.528144C0";
     print "Content-Type: text/plain;";
     print "    charset=\"iso-8859-1\"";
     print "Content-Transfer-Encoding: 7bit";
     print "";
     printf "Your " jobType " job to " number;
}

BEGIN          { nfiles = 0;
             npins = 0;
             pagewidth = 0;
             pagelength = 0;
             resolution = 0;
             jobType = "facsimile";
             signalrate = "unknown";
             dataformat = "unknown";
             doneop = "default";
                 pagernum = "unknown";
             commid = "";
           }
/^jobid/  { jobid = $2; }
/^groupid/     { groupid = $2; }
/^state/  { state = $2+0; }
/^doneop/ { doneop = $2; }
/^number/ { number = $2; }
/^external/    { number = $2; }          # override unprocessed number
/^sender/ { sender = $2; }
/^mailaddr/    { mailaddr = $2; }
/^jobtag/ { jobtag = $2; }
/^jobtype/     { jobType = $2; }
/^status/ { status = $0; sub("status:", "", status);
             if (status ~ /\\$/) {
                 sub("\\\\$", "\n", status);
                 while (getline &gt; 0) {
                  status = status $0;
                  sub("\\\\$", "\n", status);
                  if ($0 !~ /\\$/)
                      break;
                 }
             }
           }
/^resolution/  { resolution = $2; }
/^npages/ { npages = $2; }
/^totpages/    { totpages = $2; }
/^dirnum/ { dirnum = $2; }
/^commid/ { commid = $2; }
/^ntries/ { ntries = $2; }
/^ndials/ { ndials = $2; }
/^pagewidth/   { pagewidth = $2; }
/^pagelength/  { pagelength = $2; }
/^signalrate/  { signalrate = $2; }
/^dataformat/  { dataformat = $2; }
/^modem/  { modem = $2; }
/^totdials/    { totdials = $2; }
/^tottries/    { tottries = $2; }
/^client/ { client = $2; }
/^[!]*post/    { files[nfiles++] = $4; }
/^[!]*tiff/    { files[nfiles++] = $4; }
/^[!]*pcl/     { files[nfiles++] = $4; }
/^page:/  { pins[npins++] = $4; }
/^[!]page:/   { pagernum = $4; }
/^data:/  { files[nfiles++] = $4; }
/^poll/        { poll = " -p"; }
END {
     if (jobtag == "")
      jobtag = jobType " job " jobid;;
     if (doneop == "default")
      doneop = "remove";
     if (jobType == "pager")
       number = pagernum;
     if (why == "done") {
      putHeaders(jobtag " to " number " completed");
      print " was completed successfully.";
      print "";
      if (jobType == "facsimile") {
          printItem("%u", "Pages", npages);
          if (resolution == 196)
           printItem("%s", "Quality", "Fine");
          else
           printItem("%s", "Quality", "Normale");
          printItem("%u (mm)", "Page Width", pagewidth);
          printItem("%.0f (mm)", "Page Length", pagelength);
          printItem("%s", "Signal Rate", signalrate);
          printItem("%s", "Data Format", dataformat);
      }
      if (tottries != 1)
          printItem("%s (exchanges with remote device)", "Dialogues",
tottries);
      if (totdials != 1)
          printItem("%s (total phone calls placed)", "Calls", totdials);
      if (modem != "any")
          printItem("%s", "Modem", modem);
      printItem("%s", "Submitted From", client);
      printItem("%s", "JobID", jobid);
      printItem("%s", "GroupID", groupid);
      printItem("%s", "CommID", "c" commid);
      printf "\nProcessing time was " jobTime ".\n";
      if (status != "") {
          print "  Additional information:\n    " status;
          returnTranscript();
      }
         print "------=_NextPart_000_0012_01BF3CD4.528144C0";
         print "Content-Type: application/pdf;";
         print " name=\"" number ".pdf\"";
         print "Content-Transfer-Encoding: base64";
         print "Content-Disposition: inline;";
         print " filename=\"" number ".pdf\"";
         print "";
         system("/usr/bin/ps2pdf /var/spool/hylafax/" files[1] "
/var/spool/hylafax/pdfs/"number".pdf 1&gt;/dev/null 2&gt;/dev/null");
         system("/usr/bin/mimencode /var/spool/hylafax/pdfs/"number".pdf");
#    print "------=_NextPart_000_0012_01BF3CD4.528144C0";

     } else if (why == "failed") {
      putHeaders("Fax " jobtag " to " number " failed");
      printf " Failed because:\n    ";
      printStatus(status);
#    returnTranscript();
      returnToSender();

         print "------=_NextPart_000_0012_01BF3CD4.528144C0";
         print "Content-Type: application/pdf;";
         print " name=\"" jobtag ".pdf\"";
         print "Content-Transfer-Encoding: base64";
         print "Content-Disposition: inline;";
         print " filename=\"" jobtag ".pdf\"";
         print "";
         system("/usr/bin/ps2pdf12 /var/spool/hylafax/" files[1] "
/var/spool/hylafax/pdfs/failed/"number".pdf 1&gt;/dev/null 2&gt;/dev/null");
         system("/usr/bin/mimencode /var/spool/hylafax/pdfs/failed/"
number".pdf");

     } else if (why == "rejected") {
      putHeaders("Fax " jobtag " to " number " failed");
      printf " Failed because:\n    ";
      printStatus(status);
      returnToSender();
         print "------=_NextPart_000_0012_01BF3CD4.528144C0";
         print "Content-Type: application/pdf;";
         print " name=\"" jobtag ".pdf\"";
         print "Content-Transfer-Encoding: base64";
         print "Content-Disposition: inline;";
         print " filename=\"" jobtag ".pdf\"";
         print "";
         system("/usr/bin/ps2pdf12 /var/spool/hylafax/" files[1] "
/var/spool/hylafax/pdfs/failed/"number".pdf 1&gt;/dev/null 2&gt;/dev/null");
         system("/usr/bin/mimencode /var/spool/hylafax/pdfs/failed/"
number".pdf");

     } else if (why == "blocked") {
      putHeaders("Fax " jobtag " to " number " blocked");
      printf " is delayed in the scheduling queues because:\n    ";
      printStatus(status);
      print "";
      print "The job will be processed as soon as possible."
         print "------=_NextPart_000_0012_01BF3CD4.528144C0";
         print "Content-Type: application/pdf;";
         print " name=\"" jobtag ".pdf\"";
         print "Content-Transfer-Encoding: base64";
         print "Content-Disposition: inline;";
         print " filename=\"" jobtag ".pdf\"";
         print "";
         system("/usr/bin/ps2pdf12 /var/spool/hylafax/" files[1] "
/var/spool/hylafax/pdfs/failed/"number".pdf 1&gt;/dev/null 2&gt;/dev/null");
         system("/usr/bin/mimencode /var/spool/hylafax/pdfs/failed/"
number".pdf");

     } else if (why == "requeued") {
      putHeaders("Fax " jobtag " to " number " requeued");
      printf " was not sent because:\n    ";
      printStatus(status);
      print "";
      print "The job will be retried at" nextTry "."
      returnTranscript();
     } else if (why == "removed" || why == "killed") {
      putHeaders("Fax " jobtag " to " number " removed from queue");
      print " was deleted from the queue.";
      if (why == "killed")
          returnToSender();
     } else if (why == "timedout") {
      putHeaders("Fax " jobtag " to " number " failed");
      print "ould not be completed before the appointed deadline.(timeout)";
      returnToSender();
         print "------=_NextPart_000_0012_01BF3CD4.528144C0";
         print "Content-Type: application/pdf;";
         print " name=\"" jobtag ".pdf\"";
         print "Content-Transfer-Encoding: base64";
         print "Content-Disposition: inline;";
         print " filename=\"" jobtag ".pdf\"";
         print "";
         system("/usr/bin/ps2pdf12 /var/spool/hylafax/" files[1] "
/var/spool/hylafax/pdfs/failed/"number".pdf 1&gt;/dev/null 2&gt;/dev/null");
         system("/usr/bin/mimencode /var/spool/hylafax/pdfs/failed/"
number".pdf");

     } else if (why == "format_failed") {
      putHeaders("Fax " jobtag " to " number " failed");
      print " was not sent because document conversion"
      print "to facsimile failed.  The output from the converter program
was:\n";
      print status "\n";
      printf "Check any PostScript documents for non-standard fonts %s.\n",
          "and invalid constructs";
      returnToSender();
         print "------=_NextPart_000_0012_01BF3CD4.528144C0";
         print "Content-Type: application/pdf;";
         print " name=\"" jobtag ".pdf\"";
         print "Content-Transfer-Encoding: base64";
         print "Content-Disposition: inline;";
         print " filename=\"" jobtag ".pdf\"";
         print "";
         system("/usr/bin/ps2pdf12 /var/spool/hylafax/" files[1] "
/var/spool/hylafax/pdfs/failed/"number".pdf 1&gt;/dev/null 2&gt;/dev/null");
         system("/usr/bin/mimencode /var/spool/hylafax/pdfs/failed/"
number".pdf");

     } else if (why == "no_formatter") {
      putHeaders("Fax " jobtag " to " number " failed");
      print " was not sent because  ";
      print "the document conversion script was not found..";
      returnToSender();
     } else if (match(why, "poll_*")) {
      putHeaders("Notice about" jobtag);
      printf ", a polling request,\ncould not be completed because ";
      if (why == "poll_rejected")
          print "the remote side rejected your request.";
      else if (why == "poll_no_document")
          print "no document was available for retrieval.";
      else if (why == "poll_failed")
          print "an unspecified problem occurred.";
      print "";
      printf "Processing time was %s.\n", jobTime;
      returnTranscript();
     } else {
      putHeaders("Notice about " jobtag);
      print " had something happen to it."
      print "Unfortunately, the notification script was invoked",
          "with an unknown reason"
      print "so the rest of this message is for debugging:\n";
      print "why: " why;
      print "jobTime: " jobTime;
      print "nextTry: " nextTry;
      print  "";
      print "This should not happen, please report it to your
administrator.";
      returnTranscript();
      returnToSender();
     }
}





____________________ HylaFAX(tm) Users Mailing List _______________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@hylafax.org.*




Project hosted by iFAX Solutions