Revision 296 (by ahitrov, 2013/03/26 17:59:01) Promosite (anthill) project source
<%args>
	$from		=>	undef,
	$to			=>	undef,
	$data		=>	undef,
	$fields	=>	undef
</%args>

<%init>
my $subject = "Побег из Москвы: Анкета";
my $msg = qq{From: $from
To: $to
Subject: $subject
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Здравствуйте!

};

for my $field (@$fields)
{
	my $fname = (keys(%$field))[0];
	my $to_msg_fld = $fname;

	$to_msg_fld =~ s/<[^>]*>//g;

	my $value = ref($data->{$fname}) ? join (".", @{$data->{$fname}}) : $data->{$fname};

	$msg .= sprintf "%s:\n%s\n\n", $to_msg_fld, $value;
}

	return $msg;
</%init>