public void ReplyMessage(string subject, string body, string to)
{
EmailMessage message = new EmailMessage(service);
message.Subject = "re: " + subject;
message.Body = body;
message.ToRecipients.Add(to);
message.SendAndSaveCopy();
}
My question is will it also send to gmail or hotmail emails?
That completely depends on the setup of your mail server, it is generally common practice that either the from or to address needs to be a domain serviced by the mail server. So if your mail server is mymail.com, as long as its from me@mymail.com it would be able to send to gmail/yahoo/hotmail – assuming you havent managed to get on one of the black lists. Similarly, if you send it to yourself from an external address that will probably work fine too.
However, open relaying (eg sending in my example from say me@gmail.com to me@hotmail.com) will normally fail because the server would end up abused and end up on black lists and often then block proper mail too.