140 |
; |
; |
141 |
my $hdr = $msg->header; |
my $hdr = $msg->header; |
142 |
## Originator and date |
## Originator and date |
143 |
my $from = $hdr->field ('from')->add ($p{from_mail}); |
my $from = $hdr->field ('from')->add ($p{from_mail} || 'foo@bar.invalid'); |
144 |
$from->display_name ($p{from_name}) if length $p{from_name}; |
$from->display_name ($p{from_name}) if length $p{from_name}; |
145 |
my $date = $hdr->field ('date'); |
my $date = $hdr->field ('date'); |
146 |
$p{date_year} ||= (gmtime)[5]; |
$p{date_year} ||= (gmtime)[5]; |
147 |
$date->set_datetime (@p{qw/date_year date_month |
$date->set_datetime (@p{qw/date_year date_month |
148 |
date_day date_hour date_minute date_second/}, |
date_day date_hour date_minute date_second/}, |
149 |
zone => $p{date_zone}); |
zone => $p{date_zone}); |
150 |
$hdr->add ('x-uri' => $p{from_uri}) if $p{from_uri}; |
$hdr->add (x_uri => $p{from_uri}) if $p{from_uri}; |
151 |
if ($p{from_face}) { |
if ($p{from_face}) { |
152 |
$msg->header->field ('x-face')->value ($p{from_face}); |
$msg->header->field ('x-face')->value ($p{from_face}); |
153 |
} elsif ($p{faces}->{$p{from_mail}}) { |
} elsif ($p{faces}->{$p{from_mail}}) { |
158 |
## Message attribute |
## Message attribute |
159 |
if (length $p{msg_id}) { |
if (length $p{msg_id}) { |
160 |
$hdr->add ('message-id' => $p{msg_id}); |
$hdr->add ('message-id' => $p{msg_id}); |
161 |
} else { |
} elsif ($p{msg_id_from} || $p{msg_id_right} || $p{list_id}) { |
|
my $id_right = $p{msg_id_right} || $p{list_id}; |
|
162 |
my $c = $p{msg_count}; |
my $c = $p{msg_count}; |
163 |
$c = '.d'.(0+$date) unless defined $p{msg_count}; |
$c = '.d'.(0+$date) unless defined $p{msg_count}; |
164 |
my $mid = sprintf '<msg%s.BS%%list@%s>', $c, $id_right; |
my $mid; |
165 |
$mid = sprintf '<msg%s.BS%%%s>', $c, $p{msg_id_from} if $p{msg_id_from}; |
if ($p{msg_id_from}) { |
166 |
|
$mid = sprintf '<msg%s.BS%%%s%%%s>', $c, $p{list_id}, $p{msg_id_from}; |
167 |
|
} elsif ($p{msg_id_right}) { |
168 |
|
$mid = sprintf '<msg%s.BS%%%s%%list@%s>', $c, $p{list_id}, $p{msg_id_right}; |
169 |
|
} else { #if ($p{list_id}) { |
170 |
|
$mid = sprintf '<msg%s.BS%%list@%s>', $c, $p{list_id}; |
171 |
|
} |
172 |
$hdr->add (($DEBUG?'x-':'').'message-id' => $mid); |
$hdr->add (($DEBUG?'x-':'').'message-id' => $mid); |
173 |
} |
} |
174 |
$hdr->add (subject => $p{subject}) if length $p{subject}; |
if (length $p{subject}) { |
175 |
|
$hdr->add (subject => $p{subject}); |
176 |
|
} elsif (length $p{DEFAULT_subject}) { |
177 |
|
$hdr->add (subject => $p{DEFAULT_subject}); |
178 |
|
} |
179 |
my $a; |
my $a; |
180 |
for (grep {/^misc_/} keys %p) { |
for (grep {/^misc_/} keys %p) { |
181 |
$a = $hdr->field ('content-x-properties') unless ref $a; |
$a = $hdr->field ('content-x-properties') unless ref $a; |
197 |
$lid->value ($p{list_id}); |
$lid->value ($p{list_id}); |
198 |
$lid->display_name ($p{list_name}) if length $p{list_name}; |
$lid->display_name ($p{list_name}) if length $p{list_name}; |
199 |
} |
} |
200 |
$hdr->add ('x-mail-count' => $p{msg_count}) if defined $p{msg_count}; |
$hdr->add (x_mail_count => $p{msg_count}) if defined $p{msg_count}; |
201 |
$hdr->add ('x-ml-info' => $p{list_info}) if defined $p{list_info}; |
$hdr->add (x_ml_info => $p{list_info}) if defined $p{list_info}; |
202 |
if ($p{base_uri}) { |
if ($p{base_uri}) { |
203 |
my $uri = $hdr->add (x_uri => ''); |
my $uri = $hdr->add (x_uri => ''); |
204 |
$uri->value ($p{base_uri}); |
$uri->value ($p{base_uri}); |
210 |
date_time => $date->unix_time, |
date_time => $date->unix_time, |
211 |
zone => $date->zone, |
zone => $date->zone, |
212 |
fmt2str => $self->{fmt2str}, |
fmt2str => $self->{fmt2str}, |
213 |
}); |
}, \%p); |
214 |
$hdr->add ('x-uri')->value ($urn); |
$hdr->add ('x-uri')->value ($urn); |
215 |
} |
} |
216 |
## Additional information |
## Additional information |