Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Cannot get Net::SMTP to print file path with spaces properly

by yankeeblue (Novice)
on Jul 13, 2005 at 13:51 UTC ( [id://474551]=perlquestion: print w/replies, xml ) Need Help??

yankeeblue has asked for the wisdom of the Perl Monks concerning the following question:

This is driving me batty so any help would be greatly appreciated. I'm sure this is VERY simple, but I've searched and can't find an answer.

I'm using Net::SMTP and I cannot get a path to print out properly in an e-mail when it has spaces in it.

$smtp->datasend("\\\\server\\weekly reports\\report.txt");

The link to the file shows up in the e-mail with the link only up to \\server\\weekly so that the recipient cannot clink on the link to open the file. How can I get it to consider the full path the link? I've tried adding quotes but that just prints out quotes in the e-mail. Help!

Retitled by g0n from 'Cannot get Net::SMPT to print file path with spaces properly'.

Replies are listed 'Best First'.
Re: Cannot get Net::SMTP to print file path with spaces properly
by pbeckingham (Parson) on Jul 13, 2005 at 15:22 UTC

    I suggest you URL-encode it, resulting in:

    $smtp->datasend ("\\\\server\\weekly%20reports\\report.txt");



    pbeckingham - typist, perishable vertebrate.
Re: Cannot get Net::SMTP to print file path with spaces properly
by davidrw (Prior) on Jul 13, 2005 at 14:23 UTC
    It sounds like it's entirely up to the email client on how it parses for links ... will it work to send a HTML link?
    my $s = "\\\\server\\weekly reports\\report.txt"; my $url = $s; $url =~ s#\\#/#g; $url = 'file:/' . $url; $smtp->datasend( sprintf('<a href="%s">%s</a>', $url, $s) );
    Update: added the proper file:/// syntax
      I figured it out (finally found it in Outlook help). I needed to put angle brackets around the path.

      $smtp->datasend("<\\\\server\\weekly reports\\report.txt>");
      Thanks for the info but that didn't work. It showed up in the e-mail as:

      <a href="file:///server/weekly status/report.txt">\\server\weekly status\report.txt</a>
        what is the target email client? is support for html avilable/turned on?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://474551]
Approved by davidrw
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-04-19 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found