I think that you need to add the physical path to the PDF file for it to work (otherwise it may not know where the file is). This post on a forum says as follows:
The only problem is that this "mailto" command executes on the
client machine, therefore it tries to locate the attachment file by
a physical path, and not by a virtual path.
works ok, but only for local users (those connected to the same
network as the "myhost" machine).
does not work, it does not recognize such a syntax as valid for
the attachment file.
In your case you would properbly need to look at this part of the Rhomobile docs (on file system access) to get the right path to your file.
From you comment I can see that you are trying to make it work on iOS (due to the iOS specific path).
In this discussion (from Rhomobile's Google Group) it is explained that mailto doesn't support attachments on iOS. It says as follows:
Don't know about other platforms, but you cannot do this on iOS. mailto: does not support attachments on iOS.
You can do it using a native API, MFMailComposeViewController.
This is a complete controller with UI, so you would have to write a Native View Extension to use it:
I've looked around and it seems that mailto doesn't support attachments on Android either. This is because Android supports the RFC 2368 mailto protocol, which doesn't include attachments. Here is a reference to the Android mailto url parser.
I would suggest that you do as suggested for iOS, write a native extension. I think this post would be relevant for you.
I am giving the complete path but it isnt working. Code is like: <% fileNameW = File.join(Rho::RhoApplication::get_user_path(), 'demo.pdf')%> <a href="mailto:<%=@user.mgremail%>?subject=Expense Report&attachment='<%=fileNameW%>'">Mail to Manager</a>
Couldn't figure out what made you think i am doing this for ios. I am developing an Android app on Rhomobile.
As far as I can see, the 'Rho::RhoApplication::get_user_path' is iOS specific. It is only mentioned under "Rhodes client file system structure on iOS platform" in the Rhodes documentation. Maybe that is your problem ?
It is working for me at other places as well. Still i tried giving the static path as well but neither it returns any error nor it recognizes the attachment. Do you know any other alternative for this?