Programmers: Need Help!
using System.Net.Mail;
namespace MvcMembership
{
public interface ISmtpClient
{
void Send(MailMessage mailMessage);
}
}
using System.Net.Mail;
namespace MvcMembership
{
public class SmtpClientProxy : ISmtpClient
{
private readonly SmtpClient smtpClient;
public SmtpClientProxy()
{
smtpClient = new SmtpClient();
}
public SmtpClientProxy(SmtpClient smtpClient)
{
_smtpClient = smtpClient;
}
#region ISmtpClient Members
public void Send(MailMessage mailMessage)
{
_smtpClient.Send(mailMessage);
}
#endregion
}
}
[AcceptVerbs(HttpVerbs.Post)]
public RedirectToRouteResult ResetPassword(Guid id)
{
var user = userService.Get(id);
var newPassword = passwordService.ResetPassword(user);
var body = ResetPasswordBody + newPassword;
var msg = new MailMessage();
msg.To.Add(user.Email);
msg.Subject = ResetPasswordSubject;
msg.Body = body;
_smtpClient.Send(msg);
return RedirectToAction("Password", new { id });
}
ERROR:
Server Error in '/' Application.
Syntax error, command unrecognized. The server response was: Syntax error, command unrecognized.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: Syntax error, command unrecognized.
Source Error:
Line 19: public void Send(MailMessage mailMessage)
Line 20: {
Line 21: _smtpClient.Send(mailMessage);
Line 22: }
Line 23:
Source File: C:\Users\STS-Admin\Documents\Visual Studio 2010\Projects\WikiUserManagement\src\MvcMembership\SmtpClientProxy.cs Line: 21