PDA

View Full Version : Can Email link open email attachment?


Steven_Smith
04-07-2003, 03:26 AM
Can an link in an email open the attached attachment?

We would like to attach a PDF to the email and have the user click in the email to view it.

I do not want to user to click and have it download from the site. I think that I will have to do it that way, but I am hoping not.

Thanks
Steve

BTW, I am sending the email from a script, so have alot of control if I need it.

:)

zoobie
04-07-2003, 09:51 AM
Nope :D

PRob
08-06-2008, 08:18 PM
Okay. So over 5 years have passed since a response to this post...

Same goal as post where I'd like to provide a link in the email body that would open the attached file. Please tell me that after all these years there is a solution to this problem.

ninnypants
08-06-2008, 08:52 PM
If you want to link to your attachment don't attach it. Put it on your server and link to it so that it can be downloaded or just opened in the browser.

PRob
08-07-2008, 01:00 PM
The reason to link to the attached document on the email is for the capability to work offline. For example, a lawyer would need easy reference to associated documents in the court room.

The solution is below, however, this only works for a single attachment. When there are multiple attachments my email client only wants to open the first one attached regardless of the fact that each file link has a unique content id... Uncertain of "why" this happens at this point but the main objective is resolved.

MailMessage msg = new MailMessage("you@email.com", "you@email.com");
msg.Subject = "Test";
Attachment atch = new Attachment("c:\\SomeTestDoc.pdf");
atch.ContentId = Guid.NewGuid().ToString();
msg.Attachments.Add(atch);
msg.IsBodyHtml = true;
msg.Body = string.Format("This is my <a href=cid:{0}>file</a>", atch.ContentId);

SmtpClient client = new SmtpClient("localhost", 25);
client.Send(msg);