Send Fax with sendfax(1)


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function sendFax($documentPath, $faxNumbersArray)
  2. {
  3. $from = sessionManager::curentUser('names');
  4. $msg = date('j F Y H:i:s', time())."\n";
  5. $msg.= count( $faxNumbersArray )." fax request sent by " . sessionManager::curentUser('names') ." :\nDocument URL : $documentPath\n\n";
  6.  
  7. foreach ($faxNumbersArray as $faxNumber)
  8. {
  9. $command = 'sendfax -f "'.sessionManager::curentUser('email').'" -R -r "'.$from.'" -c "Document" -x "To Company" -d "Recipient@'.$faxNumber.'" '.$documentPath;
  10. $system = system( escapeshellcmd( $command ), $retval );
  11.  
  12. $msg .= "Fax number: $faxNumber\n";
  13. $msg .= "Command: $command\n";
  14. $msg .= "Server response: $retval\n\n";
  15. }
  16. $msg .= "=======================================================================\n\n";
  17. error_log($msg,3,'logs/fax_log.txt');
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.