2

I am trying to implement an email service . I have a repository class as you can see :

 ConfigRepository objConfigRepository = new ConfigRepository();

      public bool SendMail(Message message, List<User> lstUser)
      {
          bool result = true;
          try
          {
              foreach (User item in lstUser)
              {
                  int reciverId = item.Id;
                  var ConfigMail = objConfigRepository.GetAll().First();
                  //var user = objUserRepository.FindBy(i => i.Id == reciverId).First();

                  WebMail.SmtpServer = ConfigMail.SmtpServer;
                  WebMail.SmtpPort = int.Parse(ConfigMail.SmtpPort);
                  WebMail.EnableSsl = ConfigMail.EnableSsl;
                  WebMail.UserName = ConfigMail.Username;
                  WebMail.Password = ConfigMail.Password;
                  WebMail.From = ConfigMail.From;

                  WebMail.Send(to: item.Email, subject: message.Title, body: message.MsgText);

              }
          }
          catch (Exception ex)
          {
              result = false;
          }

          return result;

      }

    }

As you can see the sendmail expects 2 parameters message and userinfo.In my controller i call this method like this :

  objEmailRepository.SendMail(message, lstUser);

But i got this error :

Method not found: 'Void System.Web.Helpers.WebMail.Send(System.String, System.String, System.String, System.String, System.String, System.Collections.Generic.IEnumerable`1<System.String>, Boolean, System.Collections.Generic.IEnumerable`1<System.String>)'.

Best regards

Ehsan Akbar
  • 6,977
  • 19
  • 96
  • 180
  • The error is in this line: `WebMail.Send(to: item.Email, subject: message.Title, body: message.MsgText); ` you´re missing some params – MakePeaceGreatAgain Sep 19 '14 at 10:34
  • You know i put a breakpoint but the error is happened here objEmailRepository.SendMail(message, lstUser); and it doesn't pass the line that you point – Ehsan Akbar Sep 19 '14 at 10:36
  • What is version you used System.Web.Helpers? Maybe your referece's version is not contains this method? – Uğur Aldanmaz Sep 19 '14 at 11:14

1 Answers1

2

System.MissingMethodException: Method not found?

Just try to clean and recompile your solution, and make sure you have the latest version of dll in GAC

Community
  • 1
  • 1
mrtsl7
  • 81
  • 4