I have a mailer for Google as shown below, how can i adapt this for other mail systems? Is there a better way of doing this? also how can i change the name of where the mail is from(the sender).
All help would be much appreciated, and thank you in advance
MailMessage message = new MailMessage();
message.From = new MailAddress(MailAddresds);
message.Subject = messagesubject;
message.Body = messagebody;
message.To.Add(messageto);
SmtpClient client = new SmtpClient();
client.Credentials = new NetworkCredential(userName, password);
client.Host = "smtp.gmail.com";
client.Port = 587;
client.EnableSsl = true;
client.Send(message);
Just example:
concrete implementations:
somewhere in the code create a collection of supported mail services
after, during the program run, pick the appropriate service to proceed user request.