PDA

View Full Version : re: simple webform that links to email


ccabanero
07-04-2004, 02:38 AM
Hello,

I would like to create an asp webform that is linked to my email account. This would be a simple "contact us" form. After the user types in their first name, last name, email, and comments, they click a button and the message is sent to my email.

Does anyone have any sample code, articles, web references, etc. that they can point me to?

Thanks,

Clint

Swood
07-05-2004, 10:58 AM
I did this to send mail

1. add this line :
Imports System.Web.Mail.SmtpMail

2. setup and send the mail

Dim myEmail As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage()
'---- Set Message Properties -------------
myEmail.From = "Me@myhost.com"
myEmail.To = "Someone@TheirHost.com"
myEmail.Subject = "MySubject"
myEmail.BodyFormat = System.Web.Mail.MailFormat.Html
myEmail.Body = "MailBody"

'---- Send Message -------------------------
System.Web.Mail.SmtpMail.SmtpServer = "localhost"
System.Web.Mail.SmtpMail.Send(myEmail)