我使用下面的代码附加文件
public void SendMailMessage(string email, string subject, string body, string emailUrl, HttpPostedFileBase attachment)
{
MailMessage message = new MailMessage();
message.Subject = subject;
message.To.Add(email);
message.Body = body;
message.IsBodyHtml = true;
if (attachment != null && attachment.FileName != null)
{
message.Attachments.Add(new Attachment(attachment.InputStream, attachment.FileName));
}
EmailerClass.SendMail(message);
}
但邮件中没有附件,我们如何使用HttpPostedFileBase发送附件?