passwordRecovery control sending email via gmail account problem

Posted on 2007-10-15
Last Modified: 2008-01-09
I have a PasswordRecovery control and I want to use my own personal gmail account to test that the emails are being sent out.

I've managed to send out a mail using the following code:

 'Build the message
        Dim msg As New System.Net.Mail.MailMessage()
        msg.To.Add("Destination email address goes here")
        msg.From = New MailAddress("", "Mark", System.Text.Encoding.UTF8)

        msg.Subject = "Test mail using .net2.0"
        msg.SubjectEncoding = System.Text.Encoding.UTF8
        msg.Body = "This is my msg Body"
        msg.BodyEncoding = System.Text.Encoding.UTF8
        msg.IsBodyHtml = False
        msg.Priority = MailPriority.High

        'Add the Creddentials
        Dim Client As New SmtpClient
        Client.Credentials = New System.Net.NetworkCredential("", "mypassword")

        Client.Port = 587      
        Client.Host = ""
        Client.EnableSsl = True
        'Client.SendCompleted += New SendCompletedEventHandler(client_SendCompleted)
        ' object userState=msg;

        Catch ex As Exception

        End Try

I've taken out my email address in the above but it works fine.  The problem is how do I put these settings in the config file rather than in code.  I've used the following:

   <smtp from="">
    <network host="" password="myPassword" port="587"
     userName="" />

Again, i've removed my email and password and the username and password are correct but the above doesn't work with the PasswordRecovery control.  I think its because I need to enable SSL but how do i do this in the config file?
Question by:fizzer666
    LVL 8

    Accepted Solution

    have you validated what your are reading in. that would be the first step.

    i believe you may run into a problem at some point and be denied because relaying is not allowed.

    i would look to using your current provider and not gmail.


    Author Comment

    thanks for the advice.  I have now got it working with a different provider.  I have another question but I'll create a new post.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    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…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video discusses moving either the default database or any database to a new volume.

    734 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

    23 Experts available now in Live!

    Get 1:1 Help Now