Solved

ASP.net wizard Form  using smtp

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

706 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

19 Experts available now in Live!

Get 1:1 Help Now