+ my $headers = '';
+ foreach my $item (qw(from to cc)) {
+ next unless ($self->{$item});
+ my (@addr_objects) = Email::Address->parse($self->{$item});
+ next unless (scalar @addr_objects);
+
+ foreach my $addr_obj (@addr_objects) {
+ $addr_obj->phrase($self->mime_quote_text($addr_obj->phrase(), 60)) if ($addr_obj->phrase());
+ $addr_obj->comment($self->mime_quote_text($addr_obj->comment(), 60)) if ($addr_obj->comment());
+
+ $headers .= sprintf("%s: %s\n", ucfirst($item), $addr_obj->format());
+ }
+ }
+
+ $headers .= sprintf("Subject: %s\n", $self->mime_quote_text($self->{subject}, 60));