[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

passwordRecovery control sending email via gmail account problem

Posted on 2007-10-15
2
Medium Priority
?
807 Views
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("myEmailAddress@gmail.com", "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("myEmailAddress@gmail.com", "mypassword")

        Client.Port = 587      
        Client.Host = "smtp.gmail.com"
        Client.EnableSsl = True
        'Client.SendCompleted += New SendCompletedEventHandler(client_SendCompleted)
        ' object userState=msg;
        Try
            Client.Send(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:

<system.net>
  <mailSettings>
   <smtp from="myemail@gmail.com">
    <network host="smtp.gmail.com" password="myPassword" port="587"
     userName="myemail@gmail.com" />
   </smtp>
  </mailSettings>
 </system.net>

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?
0
Comment
Question by:fizzer666
2 Comments
 
LVL 8

Accepted Solution

by:
Autoeforms earned 2000 total points
ID: 20078384
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.

greg
0
 

Author Comment

by:fizzer666
ID: 20084072
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.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
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.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month20 days, 2 hours left to enroll

873 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