crossvertise / ActionMailerNext

Fork of ActionMailer.Net, A easy to use library to generate emails with razor views
MIT License
42 stars 24 forks source link

Object reference error when attempting to deliver an email #25

Open tigreye007 opened 8 years ago

tigreye007 commented 8 years ago

If you do not explicity specify the FROM address, you will receive an Object reference not set to an instance of an object. In a perfect world:

  1. If From address not set, attempt to set it from the web.config: MailAttributes.From = new MailAddress((WebConfigurationManager.OpenWebConfiguration("~/Web.config").GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup).Smtp.From);
  2. If still no from address set, throw a friendly argument exception "From Address must be set to a valid e-mail address"