+sub _create_attachment_part {
+ my ($self, $attachment) = @_;
+
+ my $source_file_name;
+
+ my %attributes = (
+ disposition => 'attachment',
+ encoding => 'base64',
+ );
+
+ if (ref($attachment) eq "HASH") {
+ $attributes{filename} = $attachment->{name};
+ $source_file_name = $attachment->{filename};
+
+ } else {
+ # strip path
+ $attributes{filename} = $attachment;
+ $attributes{filename} =~ s:.*\Q$self->{fileid}\E:: if $self->{fileid};
+ $attributes{filename} =~ s:.*/::g;
+ $source_file_name = $attachment;