CipherIS
asked on
C# 2008 (3.5 Framework) An object reference is required for the non-static field, method, or property
I am receiving the above error. I've indicated where the error is occurring.
Public class Sender
{
SendEmail _sendEmail = new SendEmail();
.....
public static void Send(ConfigEmail email)
{
email.body = ReplaceCode(email.body, ReplaceType.Html);
email.body = css.Replace("{MESSAGE EMAIL}", email.body);
email.body = email.body.ToString().Replace("\r\n", "<br/>");
email.body = email.body.ToString().Replace("Do not reply to this automatic message", String.Empty);
try
{
_sendEmail.Send(email); //ERROR OCCURS HERE
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
}
public class SendEmail
{
public static void Send(ConfigEmail email)
{
email.body = ReplaceCode(email.body, ReplaceType.Html);
email.body = css.Replace("{MESSAGE EMAIL}", email.body);
email.body = email.body.ToString().Replace("\r\n", "<br/>");
email.body = email.body.ToString().Replace("Do not reply to this automatic message", String.Empty);
try
{
_sendEmail.Send(email);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
public class SendEmail
{
public static void Send(ConfigEmail emailStruct)
{
//........
SendIt(emailStruct);
}
private static void SendIt(ConfigEmail emailStruct)
{
//.........
//SMTP Sending email
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER