Error: The type 'MailAddress' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Net.Mail, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.類型「MailAddress」中未被引用
var myMessage = new SendGrid.SendGridMessage();
myMessage.AddTo(model.To);
myMessage.From = new System.Net.Mail.MailAddress(model.From, model.Subject);
myMessage.Subject = model.Subject;
myMessage.Text = model.TextBody;
myMessage.Html = model.HtmlBody;
並且您是否添加了該參考? – David
另外,netcoreapp,或完整的框架? – poke
是的,我有一個參考System.Net.Mail – WanjyDan