AFAIK有處理這一專有格式沒有模塊。而是將其轉換爲標準模板系統:
my $template = <<'TEMPLATE';
Good morning, [% name %]!
Today is your first day at work. You have already received your universal login
credentials:
[% ldap_user %]
[% ldap_pass %]
It works for authenticating at the Web proxy, mail system, Jabber and internal
services. Change the password ASAP: <[% ldap_web %]>
--
Yours sincerely, the greeting daemon
TEMPLATE
use Text::Xslate qw();
my $text = Text::Xslate->new(syntax => 'TTerse')->render_string($template, {
name => 'New Bee',
ldap_user => 'nbee',
ldap_pass => 'CON-GLOM-O',
ldap_web => 'http://192.168.0.1:8080/',
});
使用MIME工具包創建電子郵件。 HTML /多/附件是容易 Courriel::Builder:
use Courriel::Builder;
my $email = build_email(
subject('Welcome'),
from('[email protected]'),
to('…'),
plain_body($text),
);
最後,使用高級別庫Email::Sender,給你不錯的錯誤檢查,並允許您輕鬆地切換出傳輸發送 - 運行測試的本地交付。
use Email::Sender::Simple qw(sendmail);
use Email::Sender::Transport::SMTP qw();
use Try::Tiny;
try {
sendmail(
$email,
{
transport => Email::Sender::Transport::SMTP->new({
host => 'smtp.example.invalid',
})
}
);
} catch {
warn "sending failed: $_";
};
你確定沒有這個嗎?我可以將整個.oft模板解析爲電子郵件主題,就像它假設的一樣。我現在運行的唯一問題似乎是一個科迪問題。整個.oft機構看起來類似於這個... ÐÏà¡\t 它似乎是一個UTF-8編碼問題,但我努力轉換一切。 – Heuristic
[開一個新主題](http://stackoverflow.com/questions/ask)爲您的後續問題。在那裏提供您的輸入數據和代碼。 – daxim