Refer -
MailAddress Constructor (String)[
^].
This constructor expects parameter to be one
string
and it should be in the email format.
So, put a debugger and check the value of
model.Email
, because it is not in the correct email format as per the error.
[Update]
The web config file includes the
system.net
node like below.
<mailsettings>
<smtp from="http://djfitz.azurewebsites.net/">
<network host="smtp.sendgrid.net" password="Password" username="username" port="25">
</network></smtp>
</mailsettings>
In this from address is mentioned as
http://djfitz.azurewebsites.net/, which is not a
email address.
So, when you call the default constructor, it takes the from address from here and it throws exception. As you are passing the from address from code, so you can remove from here, wlse provide the correct email address here.
[/Update]