Cannot send emails with ASP.NET

Posted on 2011-10-11
Medium Priority
Last Modified: 2012-05-12
Hi all,

Im receiving the following message when I try to send an email (ASP.NET)

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.3 Client was not authenticated

I configured SMTP already (IIS6) and selected INTEGRATED WINDOWS AUTHENTICATION.

But still not working.

Here's the code Im using:

Any ideas?
If System.Text.RegularExpressions.Regex.IsMatch(F1.Text, "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$") = True Then
                Dim msg As New System.Net.Mail.MailMessage
                Dim smtp As New System.Net.Mail.SmtpClient
                Dim addrFrom As New System.Net.Mail.MailAddress("noreply@mydomain.com", "Welcome to My Domain")
                msg.IsBodyHtml = True
                msg.From = addrFrom
                msg.Subject = "Test"
                msg.Body = "Test"
                smtp.Host = ""
                smtp.Port = 25
                smtp.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
                smtp.Credentials = New System.Net.NetworkCredential("Administrator", "xxxxxxxxxxx")
            End If

Open in new window

Question by:pvg1975

Accepted Solution

shahravish earned 1000 total points
ID: 36950367
Maybe use domain\username rather than just administrator?
If this is not on a domain, then use machinename\username and see if that works?

Assisted Solution

Marcin_Zawadzki earned 1000 total points
ID: 36960875
The better way is to use smtp setting from web.config, than hardcoded one.
And if ASP.NET application is working on this same machine as SMTP, than you can use PICKUP delivery method instead of NETWORK (site will put EML file in your pickup directory, and SMTP will handle this).

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question