I am using MVC5 aspplication and storing an image in both sql server table and a folder in my application and I want to add the image as an attachment to an email to users using MailMessage class. My image source looks like this:
"<p><img src=\"/postedImage/baby220210629224910.jpg\"><br></p>"
from my Linq query
public ActionResult NewsEvents(PostVM entity )
{
var dbnew = new Post();
dbnew.newsId = entity.newsId;
dbnew.Content = entity.Content;
using (var mail = new MailMessage())
{
mail.Attachments.Add(new Attachment(dbnew.Content)); dbnew.Content --->"<p><img src=\"/postedImage/baby220210629224910.jpg\"><br></p>"
}
I get an error "Illegal characters in path."
How do I get only "baby220210629224910.jpg" from the path above