I have a web site http://ssimphal.nic.in Here I want to have a feedback page and I want the comments to go directly in my hotmail email id instead of going to the database. Please help me with the code. I am using Visual Studio . Net. I am writing in VB.

Thanks in advance!

Dani AI

Generated

Building on 's C# hint, here is a practical VB.NET approach and a few things to watch for when sending feedback from a web form straight to a Hotmail/Outlook address. Converting the idea to VB is straightforward, but the real work is configuring SMTP correctly and handling security and deliverability.

Imports System.Net
Imports System.Net.Mail

' inside your handler
Dim fromAddr As New MailAddress("you@outlook.com", "Site Feedback")
Dim toAddr As String = "your@hotmail.com"
Dim msg As New MailMessage(fromAddr.Address, toAddr) With {
    .Subject = "New feedback",
    .Body = "User message here",
    .IsBodyHtml = False
}

Using smtp As New SmtpClient("smtp-mail.outlook.com", 587)
    smtp.Credentials = New NetworkCredential("you@outlook.com", "yourPassword")
    smtp.EnableSsl = True
    smtp.Send(msg)
End Using

Troubleshooting and cautions: make sure your hosting provider allows outbound SMTP on the port you choose (587 is typical for Outlook/Hotmail with STARTTLS). If the account has two-factor enabled you may need an app password or OAuth; check the provider's account/security settings. Never hardcode real passwords in code — store credentials in web.config (or secure secrets storage) and encrypt them. Validate and sanitize all form input to avoid header injection and spam, and consider adding CAPTCHA. Keep a backup copy of feedback in a database or log in case email delivery fails.

If the site will send many messages or needs reliable delivery, consider using your host's SMTP relay or a transactional email service (API or authenticated SMTP). For newer .NET projects, using libraries like MailKit gives better control than the legacy client. This covers the common pitfalls that are missing from the original replies and will make the VB conversion work reliably.

Try this code : Its in C# / Convert it into VB

using System.Net.Mail;

 try
        {
            String strFromAddress ="From@MailAddress.com";
            String strToAddress ="To@MailAddress.com";
            String strSubject = " FeedBack  ";
            String strMessageBody = "";
            String strMailHostIP = "localhost";
           
            strSubject = "Test ";

            strMessageBody = strMessageBody + " Dear Sir,\n";
            strMessageBody = strMessageBody + " The following user have given Feedback.\n\n";
            
            strMessageBody = strMessageBody + " Thanks and Regards ";

            
            MailMessage message = new MailMessage(strFromAddress, strToAddress, strSubject, strMessageBody);
            SmtpClient emailClient = new SmtpClient();
            emailClient.Host = strMailHostIP;
            emailClient.Send(message);


            lblMessage.Text = "Your mail have been successfully sent, we will contact you shortly. " ;
            lblMessage.Visible = true;



        }
        catch (Exception ex)
        {
            lblErr.Text = "Sorry,Your Feedback could not be sent. Please Try Again. ";
            lblErr.Visible = true;

        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.