#!/usr/bin/perl -s        
use warnings;    
use strict;    
#---                      
use Cwd 'abs_path';    
use lib abs_path("../../")."/sibelius2/conf";    
use Paths;
use Init;    
use ServerVars;    
use Net::Telnet;    
use MIME::Lite;
use JSON;    
#------------- 
### MimeLite necesita sendmail, para arch, sendmail esta sin atender, 
### puedes usar msmtp msmtp-mta para simular sendmail. este ultimo 
### necesita configurarse con un correo. 

my ($mod_name,$sid) =  @ARGV;
my %var = (Init::modInit($sid),%ServerVars::sk);
my $server_name = $var{'chat_srv'};

my @arr;
push (@arr,{name=>"one",tag=>"notag"});


my $to = 'benjamuga@gmail.com';
my $from = 'mensajes@vuelodegrulla.com';
my $subject = "Mensaje de $var{'mname'}";
my $message = "Enviado por:
  <h1>$var{'mname'}</h1> 
  <h2>correo:</br>$var{'mail'}<h2>
  <p>$var{'msg'}</p>
  ";

my $msg = MIME::Lite->new(
                 From     => $from,
                 To       => $to,
                 Subject  => $subject,
                 Data     => $message
                 );
                 
$msg->attr("content-type" => "text/html");
$msg->send;

print encode_json( \@arr ) ."\n";

1
__END__
