> Wow.  That's a really good idea.  In
> /usr/share/otrs/Kernel/System/Email
> I see SMTP.pm and Sendmail.pm.  Since they're modules, I'm not sure how
> to
> invoke them from a self-styled Perl script and have all the correct
> variables in-place.  Is there a way, from within OTRS, to see exactly
> what
> happens when a given module is invoked?  Or is there a way to easily
> set
> up a dummy environment for me to use so I can invoke them from my own
> Perl
> script?
> 
> Thanks much for the idea!

Again, I am going out on an absolute limb here, but here is a script that
uses OTRS to send a mail. It works for me.

Just change the email addresses, and make sure the paths to the libraries
are correct in the 'use' section.

I think what you might need to do is put this file in the cgi-bin dir. Same
permissions and everything else, then edit a template and add a button
somewhere to a page. And click it and see if the mail gets sent. Running
this script from the command line as root, won't help.

HTH,
Theunis

<SNIP>
#!/usr/bin/perl

use strict;
use FindBin qw($Bin);
use lib "$Bin/../../web-docs/otrs/";
use lib "$Bin/../../web-docs/otrs/Kernel/cpan-lib";
push (@INC, "$Bin/../../web-docs/otrs/",
"$Bin/../../web-docs/otrs/Kernel/cpan-lib");

use strict;
use Kernel::Config;
use Kernel::System::Log;
use Kernel::System::DB;
use Kernel::System::CustomerUser;
use Kernel::System::Main;
use Kernel::System::Ticket;
use Kernel::System::Email;

my $ConfigObject = Kernel::Config->new();
my $LogObject = Kernel::System::Log->new(
    ConfigObject => $ConfigObject,
);
my $MainObject = Kernel::System::Main->new(
    ConfigObject => $ConfigObject,
    LogObject => $LogObject,
);
my $DBObject = Kernel::System::DB->new(
    ConfigObject => $ConfigObject,
    LogObject => $LogObject,
    MainObject => $MainObject,
);

my $TimeObject = Kernel::System::Time->new(
    LogObject => $LogObject,
    ConfigObject => $ConfigObject,
);
my $SendObject = Kernel::System::Email->new(
    ConfigObject => $ConfigObject,
    LogObject => $LogObject,
    DBObject => $DBObject,
    MainObject => $MainObject,
    TimeObject => $TimeObject,
);


$SendObject->Send(
    From => '[EMAIL PROTECTED]',
    To => '[EMAIL PROTECTED]',
    Subject => "Test mail from OTRS",
    Type => 'text/plain',
    Charset => 'iso-8859-15',
    Body => 'Sending a test mail from OTRS. Good luck',
);
</SNIP>

_______________________________________________
OTRS mailing list: otrs - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/otrs
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/otrs

Reply via email to