Re: Sending Email using C#.
It concerns me that someone with 689 posts doesn't know the difference between a property and a method. Methods are called while properties are set. You obviously know how to set a property because you're already setting the From property. Subject and Body are also properties so they must be set in the same way, i.e. a value assigned to them.
As for the third error, just like every method, Intellisense would have told you what parameters the Send method has. Just like every method, you could have simply opened the documentation and read to know how to use it. You could have also just read your code and given it some thought. You create an SmtpClient object and then tell it to Send. What is it supposed to be sending?
Re: Sending Email using C#.
Quote:
It concerns me that someone with 689 posts doesn't know the difference between a property and a method. Methods are called while properties are set. You obviously know how to set a property because you're already setting the From property. Subject and Body are also properties so they must be set in the same way, i.e. a value assigned to them.
As for the third error, just like every method, Intellisense would have told you what parameters the Send method has. Just like every method, you could have simply opened the documentation and read to know how to use it. You could have also just read your code and given it some thought. You create an SmtpClient object and then tell it to Send. What is it supposed to be sending?
sorry jimmy i did not notice that it is property .so thanks to notify me my mistake.
so know it is ok
Code:
private void SendMail(){
MailMessage Message = new MailMessage();
Message.To.Add("[email protected]");
Message.Subject="Clark Weekly Sales";
Message.From = new MailAddress("[email protected]");
Message.Body=("Automatic Weekly Sales For Clk Brand");
SmtpClient smtp = new SmtpClient("mail.alhokair.com.sa");
smtp.Send(Message);
}