my $s = "\\\\server\\weekly reports\\report.txt"; my $url = $s; $url =~ s#\\#/#g; $url = 'file:/' . $url; $smtp->datasend( sprintf('%s', $url, $s) );