automatic Email through script?

Discussion in 'Digital Media' started by pendo, Mar 17, 2008.

  1. pendo Guest

    i need to be able to send an automatic email to an email address brought in from a textbox on button click in ASP.NET through i need info on how to do it and how i can pull content from a textbox and send it through a smtp connection to gmail. ive tried alot of code on the web but none of it works. my web page is based off line but has an open internet connection.
    any help is welcome
  2. kic_rules Guest

    Imports System.Net.Mail
    Dim myMessage As New MailMessage
    Dim SMTPSERVER As New SmtpClient
    myMessage.From = New MailAddress(myFromAddress)
    myMessage.ReplyTo = New MailAddress(myFromAddress)
    myMessage.To.Add(New MailAddress(myToAddress))
    myMessage.Bcc.Add(New MailAddress(myCCAddress))
    myMessage.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
    myMessage.IsBodyHtml = True
    myMessage.Priority = MailPriority.High
    myMessage.Subject = mySubject
    myMessage.Body = myBody
    SMTPSERVER.DeliveryMethod = SmtpDeliveryMethod.Network
    SMTPSERVER.Host = System.Configuration.ConfigurationManager.AppSettings("EMailServer")
    SMTPSERVER.Port = 25
    Dim basicAuthenticationInfo As New System.Net.NetworkCredential("emailID", "emailPW")
    SMTPSERVER.Credentials = basicAuthenticationInfo
    myMessage = Nothing
    SMTPSERVER = Nothing

Share This Page