email the contents of a form

  • Thread starter Thread starter shawn via DotNetMonster.com
  • Start date Start date
S

shawn via DotNetMonster.com

I have created a form in vb.net, where the user supplies thier name, thier
email address, and thier comments. I want to create an email message and send
the information the user supplies to me when the user clicks the submit
button on the VB form. How do I do this, making the process as automated for
the user as possible? Are there examples somewhere that I can study?
 
I found this code example, but im getting the error message "can not access
the CDO message class"

Dim email As New System.Web.Mail.MailMessage()
email.To = "RecipientAddress"
email.From = "SenderAddress"
email.Body = "MessageText"
email.Subject = "SubjectText"
email.BodyFormat = Web.Mail.MailFormat.Text
System.Web.Mail.SmtpMail.SmtpServer = "SmtpServerName"
System.Web.Mail.SmtpMail.Send(email)

I am using "mail.yahoo.com" for the value of System.Web.Mail.SmtpMail.
SmtpServer. Is that correct or should it be something else?

thanks
shawn
 
shawn via DotNetMonster.com said:
I have created a form in vb.net, where the user supplies thier name, thier
email address, and thier comments. I want to create an email message and
send
the information the user supplies to me when the user clicks the submit
button on the VB form. How do I do this, making the process as automated
for
the user as possible? Are there examples somewhere that I can study?

Sending and receiving email
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=email&lang=en>
 
this code will send an email from me to me. but what should the smtp mail
server be? i know the value i have posted here is wrong


Private Sub SubmitButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles SubmitButton.Click

Dim email As New System.Web.Mail.MailMessage
Try


email.To = "(e-mail address removed)"
email.From = "(e-mail address removed)"
email.Body = Me.RichTextBox1.Text
email.Subject = "Application Issue"
email.BodyFormat = Web.Mail.MailFormat.Text
System.Web.Mail.SmtpMail.SmtpServer = "
http://us.f329.mail.yahoo.com"
System.Web.Mail.SmtpMail.Send(email)
Catch ex As System.Web.HttpException
MsgBox(ex.ToString)
End Try



End Sub
shawn via DotNetMonster.com said:
I have created a form in vb.net, where the user supplies thier name, thier
email address, and thier comments. I want to create an email message and
[quoted text clipped - 3 lines]
for
the user as possible? Are there examples somewhere that I can study?

Sending and receiving email
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=email&lang=en>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top