Click here to Skip to main content
15,888,089 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,

I used below code for opening Client Email through hyperlink, but if I add Attachment to this it would not work as I have googled and found out that Attachment does not work here. I need alternative to this for opening Client Email plus adding attachment to it. Please help guys.

C#
hyperlinkSendmail.NavigateUrl = "mailTo:" + EmailAddress + "?subject=" + Common.MAIL_SUBJECT + "?Attachment=" + FileRef;
Posted
Updated 27-Oct-14 1:12am
v2
Comments
Sergey Alexandrovich Kryukov 27-Oct-14 7:23am    
What does not work? I don't see any attachment here... Only the word "attachment" :-).
—SA
KaushalJB 27-Oct-14 7:30am    
The FileRef contains the path to the location of file...
Sergey Alexandrovich Kryukov 27-Oct-14 8:13am    
And?
—SA
KaushalJB 27-Oct-14 8:23am    
And...Its not working :-)

mailto:// is the only protocol that enables opening the client's local mail application...All the other approaches will need some additional code (plugin)...
To be precise the mailto:// protocol does not support attachments... (https://www.ietf.org/rfc/rfc2368.txt[^]), even some browsers do support it... It is also a big question how do you know what file - from the client computer - you want to attach?! How do you know the path?!
If you have a complex scenario of mail (and not some simple-text-to-address) it is better to create a specific mail form and send the mail from the server using System.Net.Mail[^]...
 
Share this answer
 
Comments
KaushalJB 27-Oct-14 8:27am    
Thanx KEP for your response... I am developing it in SharePoint so would be long like : Download the file from List, again attaching manually and after that deleting the file automatically and then send it by SMTP. More preferable and was looking forward to opening Client Mail to send with attachment.
Kornfeld Eliyahu Peter 27-Oct-14 8:50am    
I do not see problems there - upload files, send them and delete them...
KaushalJB 28-Oct-14 1:58am    
Yes KEP but the requirement is to open Client Mail with Attachment :)... so any options ?
Kornfeld Eliyahu Peter 28-Oct-14 2:30am    
You have to bring in a 3rd party - Java, ActiveX, Silverlight...
 
Share this answer
 
v2
Comments
KaushalJB 27-Oct-14 8:02am    
Thank you kedar. Infact I read all this :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900