Criando tickets com o email no osTicket

2

Acabei de instalar um servidor osTicket para a nossa empresa e tenho problemas com a criação de tickets a partir do email. Estou usando o Postfix como meu servidor SMTP e o Dovecot como meu servidor IMAP.

No painel osTicket, não recebo nenhum erro ao definir a configuração de e-mail. Mas quando eu enviei um email para [email protected], ele não cria nenhum ticket no meu painel do osticket. Eu verifiquei o meu registro de e-mail e tudo parece bem. Eu acho que há algo errado com o meu arquivo "automail.php".

Eu ficarei muito feliz se você puder me ajudar. Agradecemos antecipadamente.

arquivo automail.php:

***
#!/usr/bin/php -q
<?php
/*********************************************************************
    automail.php

    PHP script used for remote email piping...same as as the perl version.

    Peter Rotich <[email protected]>
    Copyright (c)  2006-2013 osTicket
    http://www.osticket.com

    Released under the GNU General Public License WITHOUT ANY WARRANTY.
    See LICENSE.TXT for details.

    vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/

# Configuration: Enter the url and key. That is it.
#  url => URL to api/tickets.email e.g http://yourdomain.com/support/api/tickets.email
#  key => API's Key (see admin panel on how to generate a key)
#

$config = array(
        'url'=>'support.example.com/tickets.php',
        'key'=>'A12857AA982EEE5612EF8F2443538D76'
        );

#pre-checks
function_exists('file_get_contents') or die('upgrade php >=4.3');
function_exists('curl_version') or die('CURL support required');
#read stdin (piped email)
$data=file_get_contents('php://stdin') or die('Error reading stdin. No message');

#set timeout
set_time_limit(10);

#curl post
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $config['url']);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_USERAGENT, 'osTicket API Client v1.7');
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Expect:', 'X-API-Key: '.$config['key']));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
$result=curl_exec($ch);
curl_close($ch);

//Use postfix exit codes...expected by MTA.
$code = 75;
if(preg_match('/HTTP\/.* ([0-9]+) .*/', $result, $status)) {
    switch($status[1]) {
        case 201: //Success
            $code = 0;
            break;
        case 400:
            $code = 66;
            break;
        case 401: /* permission denied */
        case 403:
            $code = 77;
            break;
        case 415:
        case 416:
        case 417:
        case 501:
            $code = 65;
            break;
        case 503:
            $code = 69;
            break;
        case 500: //Server error.
        default: //Temp (unknown) failure - retry
            $code = 75;
    }
}

exit($code);
?>
por Ati 22.02.2016 / 10:45

1 resposta

1

De acordo com a documentação oficial do osTicket, existem dois métodos para buscar e-mails: Piping de Email e Polling POP3 / IMAP. E ambos exigem configuração adicional, o que você está perdendo.

Routing Incoming Emails

Setting up your system to accept emails varies from system to system and depends on your personal preference. osTicket currently supports piping (aliases) and POP3/IMAP polling methods for routing incoming emails. Tickets are routed to the department and assigned a default priority associated with the email.

To enable incoming email fetching, in the Admin panel go to Settings and Email, and check the box for Email Fetching to enable it. It is disabled by default.

Email Piping

Piping method allows for real-time email handling. Extra setup is required at mail server level to pipe the raw email message to osTicket pipe handler. Both remote and local piping are supported. See Email Piping Guide.

POP3/IMAP Polling

POP3/IMAP account polling method is best suited for individuals with remote mail account(s) and/or with limited access to mail delivery settings. Each email address added to the system can have an account associated to it. See POP3/IMAP Setting Guide.

    
por 22.02.2016 / 22:36