0

I created an email in ASP.NET and I want to add a link to the body, but this not a normal url, its a file that is created via byte array and now I want that file to be linkable in my email, but no matter what I do the link is clickable but nothing opens, here is my code:

FileContentResult eventPass = new FileContentResult(generatedPass, "application/vnd.apple.pkpass");

eventPass.FileDownloadName = "preview.pkpass";

message += "<a href='//" + eventPass + "' target='_blank'>Click Here</a>";
AlternateView alternateView = AlternateView.CreateAlternateViewFromString(message, null, MediaTypeNames.Text.Html);
            alternateView.LinkedResources.Add(inline);

email.AlternateViews.Add(alternateView);
                email.IsBodyHtml = true;
                email.Headers.Add("Content-Type", "application/vnd.apple.pkpass");

I know the file is generated correctly because if I return eventPass the file downloads.

Do I need to save eventPass to the server?

user979331
  • 11,039
  • 73
  • 223
  • 418

1 Answers1

-1

Possible answer here:

How to set mime type of application/vnd.apple.pkpass in order to share pass by link or email

Please mark my answer as correct if this has helped you.

Sea Charp
  • 288
  • 1
  • 6
  • Please describe your solution in the answer so that someone looking at the question doesn't need to go to external page to see it. Adding link to an external page is not enough. Also you don't need to ask the questioner to mark your answer as correct as part of the answer. If you like, you can ask him/her in a comment. – Mustafa Nov 18 '17 at 03:20