#!/usr/bin/perl -w

use MIME::Lite;


$data = '';
open(MODELE,'Newsletter.html');
while (my $l=<MODELE>) {
	chomp($l);
	$data .= "$l\n";
}


my $mail = MIME::Lite -> new (
	Type => "multipart/related",
	From => 'newsletter@thefreecat.org',
	To => 'Jissouille <cat@thefreecat.org>',
#	To => 'tfc-newsletter@thefreecat.org',
	Subject => '[TheFreeCat] Newletter - Mars 2019',
#	Charset     => 'iso-8859-1',
	Charset	=> 'utf-8',
	Type    =>'multipart/related'
);
$mail->attach(
	Type => 'text/html; charset=utf-8',
	Data => $data
);
$mail->attach(
	Type => 'image/jpeg',
	Id => 'piledisques',
	Path => 'PileDeDisques660.jpg'
);
$mail->attach(
	Type => 'image/png',
	Id => 'logoinpro',
	Path => 'LogoInpro.png'
);
$mail->attach(
	Type => 'image/png',
	Id => 'logolesage',
	Path => 'LogoSage.png'
);
$mail->attach(
	Type => 'image/png',
	Id => 'logotfc',
	Path => 'tfclogo.png'
);
$mail->attach(
	Type => 'image/png',
	Id => 'divers',
	Path => 'Divers660.png'
);
$mail->attach(
	Type => 'image/png',
	Id => 'pompier',
	Path => 'fire-truck-mini.png'
);



#if (utf8::is_utf8($data)) {
#	$data = encode('iso-8859-1',$data);
#	print "convert to latin1\n";
#}
#else {
#	print "is latin1\n";
#}
$mail -> send("sendmail",'/usr/sbin/sendmail -f newletter@thefreecat.org');
