TripletaiL Japanese Web Application Framework
メールを送信してみましょう。
#!/usr/local/bin/perl
use strict;
use warnings;
use Tripletail qw(tl.ini);
$TL->startCgi(
-main => \&main,
);
sub main
{
my $from = '';
my $to = '';
my $subject = '';
my $text = '';
my $mail = $TL->newMail->setHeader(
From => $from,
To => $to,
Subject => $subject,
)->setBody($text)->toStr;
my $sendmail = $TL->newSendmail->connect
->send(
-from => $from,
-rcpt => $to,
-data => $mail,
)->disconnect;
my $t = $TL->newTemplate('template.html', 'utf8');
$t->expand(
FROM => $from,
TO => $to,
SUBJECT => $subject,
TEXT => $text,
);
$t->flush;
}
[TL]
[Sendmail]
method = smtp
<!DOCTYPE html>
<HTML>
<BODY>
<&FROM>
<br>
<&TO>
<br>
<&SUBJECT>
<br>
<&TEXT>
<br>
へ送信しました。
</BODY>
</HTML>
$from
, $to
, $subject
, $text
にそれぞれ文字列を設定してください。