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

Correct NullReferenceException when From address not explicitly set #17

Closed tigreye007 closed 1 year ago

tigreye007 commented 8 years ago

Workaround: set the from address explicitly from the web.config on controller initialize:

    protected override void Initialize(System.Web.Routing.RequestContext requestContext)
    {
        base.Initialize(requestContext);

        var section = ConfigurationManager.GetSection("system.net/mailSettings/smtp") as SmtpSection;
        MailAttributes.From = new System.Net.Mail.MailAddress(section.From);
    }
Eonasdan commented 8 years ago

this has been fixed in PR #23