my $attached = $code ? { attach_path => $file_name, attach_filename => $file_name, attach_type => 'application/txt' } : {};