Solved

ASP.net wizard Form  using smtp

Posted on 2009-04-09
1
358 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

740 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