Can I send an email using the VS2010 development server?

Can I send an email using the VS2010 development server? If possible, can someone point me to a sample webpage?

I would like to send an email to the person who registered to confirm that we (yes or no) have received his request. The email will contain some relevant information, such as name, time and son.

EDIT

In my work, we collect data and those who need it, while the ministry in which we work tells about it. After receiving the paper form, we write an email to the form sender. So far, we have been using a paper form to know who needs the data. I would like to post this form on the Internet, and also be able to generate an email to the sender of the request. Therefore, since I am still developing the application, I need to check how email will work. That's why I ask if I can send an email, for example, to my Yahoo account from my laptop using the VS2008 web development server.

I remember 2 years ago, when learning HTML with DreamWeaver, we could send emails and receive them on our Yahoo email accounts (without any special configuration).

thanks for the help

+3
source share
2 answers

The web server will not make any difference. Regardless of whether you can depend on the environment in which your server is located.

The easiest option is to use the built-in .NET email classes. You are probably using .NET 3.5, for System.Net.Mailexample

MailMessage message = new MailMessage()
                       {
                         From = new MailAddress("you@youraddress", "Your Name"),
                         Subject = "The subject",
                         Body = @"Simple text body; set IsBodyHtml for HTML"
                       };
message.To.Add(new MailAddress("first@recipient.address", "First recipient - can add more"));
SmtpClient smtpClient = new SmtpClient("your.smtp.server");
smtpClient.Send(message);

If you do not specify the name of the SMTP server in the constructor, it will read it from web.config.

If you do not have access to the SMTP server, but you have permission to use external web services, you can use something like http://postmarkapp.com/ - I saw other questions about them here, but I didn’t use it myself their.

+3
source

Not directly answering the question, but:

, , , - SMTP, smtp4dev,

+3

Source: https://habr.com/ru/post/1758200/


All Articles