can anyone help me.. im trying to send an email to a user who forgots his/her password.. i configured my web.config into the codes below but still getting this error message..please help...

<system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="faye@webmaster.com">
        
        <network host="dddweb\sqlexpress"
                 port="25"
                 />
      </smtp>
    </mailSettings>
  </system.net>

sqlexpress is a named instance of an SQL server.

I would do it in code with the system.net.mail namespace...

Dim User_Password as String

'''''''' FIRST GET THE PASSWORD FROM THE DATABASE

User_Password = YOUR USER'S PASSWORD


    

        Dim ObjectMail As New SmtpClient("MAILSERVER", 25)
        ObjectMail.EnableSsl = False
        ObjectMail.Credentials = New Net.NetworkCredential("USERNAME", "PASSWORD")
        Dim TheMessage As New MailMessage
        TheMessage.From = New MailAddress("NoReply@YOURDOMAIN.COM", "YourDomain.Com")
        TheMessage.To.Add("email@somedomain.com")
        TheMessage.Subject = "Your Password"
 Dim MB As New StringBuilder
        MB.Append("Your password is: " & User_Password)

        TheMessage.Body = MB.ToString
        ObjectMail.Send(TheMessage)

hi there.. i need not to construct an email.. asp will automatically send an email concerning their forgotten password. i used the password recovery control. my problem is how to configure my web.config file so that when the user answer the security question, the system will automatically send the password to the user's email-ad... right now i changed the config setting to...

<system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="myemail@yahoo.com">
        <network host="DDDweb" 
                 port="25"/>
      </smtp>
    </mailSettings>
  </system.net>

i got a different error message...

No connection could be made because the target machine actively refused it 192.168.252.108:21

What happens on port 25?

sorry typographical error..it should be port 25 instead of 21...:)

Do you have an SMTP server on that machine? Could there be a firewall issue?

i already turned off the firewall setting of my PC.. i also enable the internet mail server SMTP in the advanced settings of my firewall... what else should i do? thanks a lot for replying..

do i need to install an IIS to make the sending of email possible??

try this

<configuration>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="network">
        <network
          host="localhost"
          port="25"
          defaultCredentials="true"
        />
      </smtp>
    </mailSettings>
  </system.net>
</configuration>

If default credentials do not work -- try the using the Admin User and pwd.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.