- or download this
my @to;
for my $em ( @$records ) {
push @to, @$em;
}
- or download this
# Slice makes it return an arrayref of hashrefs
my $records = $query->fetchall_arrayref({});
...
my $email= ...
sendmail($email, { transport => $transport });
}
- or download this
$transport= Email::Sender::Transport::SMTP::Persistent->new(
host => $host,
...
$pass? (sasl_password => $pass) : (),
debug => $log->is_trace,
);
- or download this
# Assuming you start with an HTML document for your email:
$text= HTML::FormatText::WithLinks->new(unique_links => 1)
->parse($html);
- or download this
# Because most mail clients don't properly process <style> blocks,
# we have to embed the style onto each individual element.
...
my $inliner= CSS::Inliner->new();
$inliner->read({ html => $html, charset => 'utf8' });
$html= $inliner->inlinify;
- or download this
# Build the email. The resolver will find all external images
# and stylesheets and suck them in as multiple parts.
...
$email->header_str_set(From =>
(ref $from eq 'ARRAY'? join(', ',@$from) : ''.$from));
$email->header_str_set(Subject => ''.$subject);