I need to know the object name for handling emails in C#/.NET Framework.
+3
A:
System.Net.Mail is the namespace to look in. Start with SmtpClient or MailMessage.
tvanfosson
2009-05-09 20:06:55
+6
A:
You need the namespace System.Net.Mail.
Here is an example from the ScottGu's blog.
MailMessage message = new MailMessage();
message.From = new MailAddress("[email protected]");
message.To.Add(new MailAddress("[email protected]"));
message.To.Add(new MailAddress("[email protected]"));
message.To.Add(new MailAddress("[email protected]"));
message.CC.Add(new MailAddress("[email protected]"));
message.Subject = "This is my subject";
message.Body = "This is the content";
SmtpClient client = new SmtpClient();
client.Send(message);
eKek0
2009-05-09 20:07:21
+2
A:
In addition to Ekeko's answer if you would like to use an external mail server you must specify the host in the SmtpClient constructor.
SmtpClient client = new SmtpClient("mail.yourmailserver.com");
And you might also need authentication to be specified if your server requires it.
client.Credentials = new NetworkCredential("username", "password");
j0tt
2009-05-09 20:20:31
A:
These answers are assuming that you are asking about SMTP handling. POP3 is not handled natively in the .NET framework. You will have to purchase a third-party library. I'd recommend the Ostrosoft POP3 library.
hmcclungiii
2009-05-09 20:41:51
A:
There is a bunch of questions in stack Overflow that describes how you can send.
ecleel
2009-05-09 20:41:55