I have a C# Web App (Using ASP.NET 2.0) and I want to use it to send email. I have researched about this online, but I’ve only gotten more confused. I have learned some basics, but it isn’t getting me anywhere. Here’s what I have so far:
MailMessage message = new MailMessage(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text);
SmtpClient emailClient = new SmtpClient(txtSMTPServer.Text);
emailClient.Send(message);
All the controls prefixed txt are text boxes. I got part of this from an onlin tutorial, but it doesn’t work because I’m not sure what I should put in the SMTP server Textbox. Can anyone help me?
Thanks
You need to put in your local SMTP server – probably the one in the same network as your web server. You may even be able to just use “localhost” if the IIS you’re running on sends mail as well. Alternatively, are you running Exchange somewhere in the network?