Back Home

Open Designs

Community. Driven.

    • CommentAuthorjdean43
    • CommentTimeFeb 13th 2007
     
    I have a form like this http://sahcinfo.org/hikeschedule1.aspx that will post data to a database, it is a detailsview input form, I am trying to email the form results as well as have it post to the database. Thanks for your help.
  1.  
    You will want to use an event to fire off your email. I would think you would do well to use the ItemInserted event on the DetailsView. This will let you fire the email as they add items to your database.

    Depending on your needs, you can format the email however you like (HTML possibly), and send it on its way.
    • CommentAuthorjdean43
    • CommentTimeFeb 13th 2007
     
    What would actually send the email, cdosys or system.net.mail, can you elaborate more?

    Thanks
  2.  
    Here's an excerpt from the mailing script that I use on my site, www.barnyardbbs.com. I use authenticated mail, that's why it uses the credentials.

    Dim MySMTPClient As New System.Net.Mail.SmtpClient
    MySMTPClient.Host = "mail.server.com"
    MySMTPClient.UseDefaultCredentials = False
    MySMTPClient.Credentials = New System.Net.NetworkCredential("UserName","Password")
    MySMTPClient.Send("your@address.com", "your@website.com", "Subject", "Body")

    In the real one, I use values from the live form. I substituted strings for simplicity. You'll want to use the event arguments from your event.

    Hope this helps.