I am browsing my application trying to clear the code sending emails. I started creating my own mailbox wrapper class, but then I realized that there should be a standard email class there. I did some searches but found nothing.
Also, is there a code base for such things somewhere?
EDIT : Sorry, let me clarify.
I do not want to have this in my code at any time when I need to send an email:
System.Web.Mail.MailMessage message=new System.Web.Mail.MailMessage(); message.From="from e-mail"; message.To="to e-mail"; message.Subject="Message Subject"; message.Body="Message Body"; System.Web.Mail.SmtpMail.SmtpServer="SMTP Server Address"; System.Web.Mail.SmtpMail.Send(message);
I created a class called Emailer that contains functions such as:
SendEmail(string to, string from, string body) SendEmail(string to, string from, string body, bool isHtml)
And so I can just put this line in my code to send an email:
Emailer.SendEmail(" name@site.com ", " name2@site.com ", "My e-mail", false);
I mean, this is not too complicated, but I thought there was a standard, accepted solution there.
source share