Auto-reply when creating article

Moderator: crythias

Locked
pwaring
Znuny newbie
Posts: 9
Joined: 02 Apr 2014, 13:45
Znuny Version: 3.2.10
Contact:

Auto-reply when creating article

Post by pwaring »

I'm using the following code to create a new article on an existing ticket:

Code: Select all

my $article_id = $TicketObject->ArticleCreate(
  TicketID => $ticket_id,
  ArticleType => 'email-external',
  SenderType => 'system',
  From => $first_article{'ToRealname'},
  To => $first_article{'From'},
  Subject => 'Forwarding ticket',
  Body => $nc_output,
  ContentType => 'text/plain; charset=ISO-8859-15',
  HistoryType => 'EmailCustomer',
  HistoryComment => 'Notified customer of ticket forwarding',
  UserID => $self->get_query('UserID'),
  AutoResponseType => 'auto reply',
  OrigHeader => {
    From => $first_article{'ToRealname'},
    To => $first_article{'From'},
    Subject => 'Forwarding ticket',
  },
);
This runs successfully and I can see the new article in the ticket system. However, I also want the content of the article to be sent to the customer who raised the ticket (details in $first_article). Is there another parameter that I've missed, or do I need to call SendAutoResponse separately?
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Auto-reply when creating article

Post by crythias »

perldoc Email
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
pwaring
Znuny newbie
Posts: 9
Joined: 02 Apr 2014, 13:45
Znuny Version: 3.2.10
Contact:

Re: Auto-reply when creating article

Post by pwaring »

I know how to send emails in Perl, but OTRS has its own functionality for sending out replies to tickets to the customer. I'd prefer to have OTRS automatically take care of the reply if possible rather than duplicating the effort in my own code.
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Auto-reply when creating article

Post by crythias »

:) I apologize for not clarifying that you might choose to use OTRS Kernel/System/Email to send separately.
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
crythias
Moderator
Posts: 10170
Joined: 04 May 2010, 18:38
Znuny Version: 5.0.x
Location: SouthWest Florida, USA
Contact:

Re: Auto-reply when creating article

Post by crythias »

Look at Kernel/Modules/AgentTicketCompose.pm

Code: Select all

        # send email
        my $ArticleID = $Self->{TicketObject}->ArticleSend(
            ArticleTypeID  => $GetParam{ArticleTypeID},
            SenderType     => 'agent',
            TicketID       => $Self->{TicketID},
            HistoryType    => 'SendAnswer',
            HistoryComment => "\%\%$Recipients",
            From           => $GetParam{From},
            To             => $GetParam{To},
            Cc             => $GetParam{Cc},
            Bcc            => $GetParam{Bcc},
            Subject        => $GetParam{Subject},
            UserID         => $Self->{UserID},
            Body           => $GetParam{Body},
            InReplyTo      => $GetParam{InReplyTo},
            References     => $GetParam{References},
            Charset        => $Self->{LayoutObject}->{UserCharset},
            MimeType       => $MimeType,
            Attachment     => \@AttachmentData,
            %ArticleParam,
        );
OTRS 6.0.x (private/testing/public) on Linux with MySQL database.
Please edit your signature to include your OTRS version, Operating System, and database type.
Click Subscribe Topic below to get notifications. Consider amending your topic title to include [SOLVED] if it is so.
Need help? Before you ask
pwaring
Znuny newbie
Posts: 9
Joined: 02 Apr 2014, 13:45
Znuny Version: 3.2.10
Contact:

Re: Auto-reply when creating article

Post by pwaring »

Ah, I need to use ArticleSend instead (which seems to do the same as ArticleCreate except send the email as well). Changing that one call fixed everything. Thanks. :)
Locked