Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.net wizard Form  using smtp

Posted on 2009-04-09
1
Medium Priority
?
371 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 1500 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

824 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