Exactly how, and where, do I place the actual file location for the string attachmentPath
:
public virtual MailMessage Welcome(string attachmentPath)
{
var mailMessage = new MailMessage{Subject = "Welcome to MvcMailer"};
...
mailMessage.Attachments.Add(new Attachment(attachmentPath));
PopulateBody(mailMessage, "Welcome");
return mailMessage;
}
Presume a physical file location on the server of c:\inetpub\server\website\docs\test.pdf
Just replace attachmentPath with @"c:\inetpub\server\website\docs\test.pdf" like this:
Change attachmentPath
mailMessage.Attachments.Add(new Attachment(attachmentPath));
to @"c:\inetpub\server\website\docs\test.pdf"
mailMessage.Attachments.Add(new Attachment(@"c:\inetpub\server\website\docs\test.pdf"));