c# - Email not sending ASP.NET MVC 4 Using SMTPClient -


i add more functionalities method, such email sent once user has edited data. debugged code no errors generated not know going wrong.

 [httppost]     public actionresult edit(editptg eptg)     {         try         {             using (managegrade gradelogic = new managegrade(ref uow))             {                 foreach (var ptg in eptg.ptgforgrade)                 {                     ptg.overwritten = true;                     ptg.active = true;                     producttogradelogic.update(ptg);                 }                  //need investigate why need recalculate grade @ point of time - sri mark??                 //eptg.grade = gradehelpers.recalculategradestringfromproductassignment(eptg.ptgforgrade, eptg.grade);                 smtpclient smtpclient = new smtpclient("www.hotmail.com", 25);                 // smtpclient.credentials = new system.net.networkcredential("username", "password");                 smtpclient.usedefaultcredentials = true;                 smtpclient.deliverymethod = smtpdeliverymethod.network;                 smtpclient.enablessl = true;                 mailmessage mail = new mailmessage();                  mail.from = new mailaddress("www.example.com");                 mail.to.add(new mailaddress("hi@hotmail.com"));                 mail.cc.add(new mailaddress("hello@hotmail.com"));                  smtpclient.send(mail);                 gradelogic.update(eptg.grade);                     tempdata["success"] = "edit successful";                    return redirecttoaction("index");              }          }         catch         {             tempdata["failure"] = "edit failed, please review selections , try again.";             return view(eptg);         }         } 


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -