Solved

ASP.net wizard Form  using smtp

Posted on 2009-04-09
1
353 Views
Last Modified: 2012-05-06
I wanted to create a feed back form using asp.net wizard function. I tried watching video and made the page but at the end when I tried to send the message I get an error.

The SMTP sever requires a secure connection or the client was not authenticated.
The server response was 5.7.0

I did expect this error becuase when you look at the code below, I did not find a place to put a password or a port number.

NEED HELP.
Imports System.Net.Mail
 
 

Partial Class _Default

    Inherits System.Web.UI.Page
 

    Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

        If txtComments.Text.Length > 10 Then

            args.IsValid = False

        Else

            args.IsValid = True

        End If

    End Sub
 

    Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick

        SendMail(txtEmail.Text, txtComments.Text)

    End Sub
 

    Private Sub SendMail(ByVal from As String, ByVal body As String)

        Dim mailServerName As String = "smtp.gmail.com"

        Dim message As MailMessage = New MailMessage(from, "myemail@gmail.com", "feedback", body)

        Dim mailClient As SmtpClient = New SmtpClient
 

        mailClient.Host = mailServerName

        mailClient.Send(message)

        message.Dispose()

    End Sub

End Class

Open in new window

0
Comment
Question by:tower7
1 Comment
 

Accepted Solution

by:
mattK-- earned 500 total points
ID: 24113024
take a look at the example from this page:

http://www.codeproject.com/KB/aspnet/SMTPGmail.aspx

you basically need to add Credentials; correct port#; and Ssl enabled.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

895 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now