Ramya Niranjan wrote:
> I am trying to use the mail task to send a particular network share 
> link into a RTF file so that users could click on this link to 
> naviagte to the correct location. But the out always goes as a normal 
> text file. This is what I am trying:
>  
> <?xml version="1.0" ?>
> <project name="sample" default="default">
>   <target name="default">
>      <property name="netshare" value="\\hostname\sharename\foldername" 
> <file://%5C%5Chostname%5Csharename%5Cfoldername%22>/>
>      <echo message="${netshare}" file=".\usedfolder.rtf"/>
>      <mail mailhost="myhost"
>               format="Html"
>               from="[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>"
>               to="[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>">
>         <files>
>                    <include name="*.\userfolder.rtf"> 
>         </files>
>   </target>
> </project>
>  
You're doing this backwards, and hence it's not working.

What you're doing is telling NAnt that the file format is HTML, but then 
you're writing plain text into that file.  So it gets sent out as 
ordinary text in an HTML mail message, with no <a> tag, and hence won't 
be a live link.  Setting the format to HTML doesn't convert a plain text 
file into HTML; it just sets the MIME type for the email.  Likewise, 
putting ".rtf" at the end of a file name doesn't convert the content 
into rich text, it just makes MS Windows think that that's what's in the 
file.

The easy way to do this is to let the mail client do all the work.  Just 
set the format to be text, and send it out.  Depending upon the client, 
you may need to add the protocol, which means rewriting the network 
share as "file:///hostname/sharename/foldername" or some such thing, but 
it can be made to work (though perhaps not for multiple clients 
simultaneously).

If that's not good enough, then write out the full HTML for the message, 
e.g. <html><head></head><body><a href="\\hostname\sharename\foldername"> 
<file://%5C%5Chostname%5Csharename%5Cfoldername%22>\\hostname\sharename\foldername
 
<a></body></html>.  <file://%5C%5Chostname%5Csharename%5Cfoldername%22>

You could even go as far as having a static body in XHTML, and just 
using NAnt's <xmlpoke> task to insert the values that change.  But once 
you go that far, you may discover you're better off just serving the 
files off a web server.  UNC names and network shares, while easy to 
access, are a pain to manipulate.  (And reporting results via a server 
leads down the path to CC.Net).

Gary




-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to