Solved

ASP.net wizard Form  using smtp

Posted on 2009-04-09
1
360 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
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 …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

738 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