Show address_mail.html syntax highlighted
% # vim:set syntax=mason:
<%args>
@tolist => ()
@cclist => ()
@bcclist => ()
</%args>
<%init>
my $user = Apache::SiteControl->getCurrentUser($r);
my $book = new AlphaMail::AddressBook($user->getUsername(), $user->getAttribute('imap'), $config);
my $composition = new AlphaMail::Message($user, $config);
$composition->load();
# Steps:
# 1. figure out which of the addresses the user had already typed are not in
# the contact list at all....these are "keepers" since we should not modify
# them.
my (@addrs, @old);
my (@tl, @cl, @bl);
my ($k, $a);
@old = Email::Address->parse($composition->{to});
for my $a (@old) {
if(!$book->get_entry($a->address) && !$book->has_list($a->original)) {
push @tl, $a->format;
}
}
@old = Email::Address->parse($composition->{cc});
for my $a (@old) {
if(!$book->get_entry($a->address) && !$book->has_list($a->original)) {
push @cl, $a->format;
}
}
@old = Email::Address->parse($composition->{bcc});
for my $a (@old) {
if(!$book->get_entry($a->address) && !$book->has_list($a->original)) {
push @bl, $a->format;
}
}
# 2. Add those items that are left in the "checked" list from submission.
for $k (@tolist) {
$a = $book->get_entry($k) || $k;
push @tl, $a;
}
for $k (@cclist) {
$a = $book->get_entry($k) || $k;
push @cl, $a;
}
for $k (@bcclist) {
$a = $book->get_entry($k) || $k;
push @bl, $a;
}
{
local $" = ", ";
$composition->setAddresses("@tl", "@cl", "@bl");
}
$composition->save();
$m->redirect("/mail/compose.html");
</%init>
<%once>
use AlphaMail::Message;
our $logger = Log::Log4perl->get_logger('alphamail');
</%once>
See more files for this project here