views:

57

answers:

5

Hi, everyone! I'm trying to send mail in ASP.NET web-site. I have smtp configuration section in web.config file. How can I configure it to send mail from everyone to everyone?

A: 

You can use SMTPClient class from System.Net.Mail

SmtpClient Class

il_guru
A: 

See this similar SO question on how to sent email using .NET

John Sibly
A: 

Is this what you're looking for?

SmtpMail.Send("From","To","Subject","Message");

Just specify the From and To email addresses and you're set.

SmtpMail can be found in System.Web.Mail.

Martin S.
A: 

You don't need to have anything in web.config as que SMTP server can be specified in the SmtpClient constructor. Then, if you need authentication, you can specify a NetworkCredential and the message in a MailMessage object. Example:

var client = new SmtpClient(smtpHost);
client.Credentials = new NetworkCredential(username, password);
var message = new MailMessage(from, to, subject, body);

client.Send(m);
Marc Climent
A: 

Hi,

Your question is a bit vauge.

If you want to send it from "everyone", then you will always need to specify a different FROM parameter for every message. You do not want to set the FROM value in the .config file.

If you are looking for code examples, I encourge you to check out my site at www.SystemNetMail.com

hth,
Dave

dave wanta