|
-
Sep 5th, 2005, 08:09 AM
#1
Thread Starter
Fanatic Member
send email from webform
i have a webform with the txtboxes
txtName
txtFrom
txtTo
txtCc
txtComments
i have the following code.
any help at all would be greatly appreciated
i have a few errors so as i cannot run it the errors shall be in red below
Public Class WebForm1
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Public Sub sendmail()
Dim objEmail As New MailMessage - (type mail message is not defined)
objEmail.To = txtTo.Text
objEmail.From = txtFrom.Text
objEmail.Cc = txtCc.Text
objEmail.Subject = "Test Email"
objEmail.Body = txtName.Text & ", " & txtComments.Text
' objEmail.Priority = MailPriority.High
SmtpMail.SmtpServer = "localhost" - smtpmail not declared
Try
SmtpMail.Send(EMail) - also not declared
Response.Write("Your E-mail has been sent sucessfully Thank You")
Catch exc As Exception
Response.Write("Send failure: " + exc.ToString())
End Try
End Sub
End Class
-
Sep 5th, 2005, 08:34 AM
#2
Frenzied Member
Re: send email from webform
Have you referenced the System.Web.Mail namespace?
DJ
If I have been helpful please rate my post. If I haven't tell me!
-
Sep 5th, 2005, 08:57 AM
#3
Thread Starter
Fanatic Member
Re: send email from webform
just done that there now buddy, searchin the web,
now the only error it seems is that the name email is not declared
SmtpMail.Send(EMail) - also not declared
where should i declare this,
thanks
-
Sep 5th, 2005, 09:02 AM
#4
Frenzied Member
Re: send email from webform
There is no Email object try changing it to objEmail which is the MailMessage object.
DJ
If I have been helpful please rate my post. If I haven't tell me!
-
Sep 5th, 2005, 09:13 AM
#5
Thread Starter
Fanatic Member
Re: send email from webform
dj that took away all my errors and now the form works i think,
i say i think because the message appears "message sent thankyou" but no message appears in my hotmail box.
the reason i think for this is that i am on a network coming from a router.(just started today)
my forms are unable to be viewed over the internet from other machines
this change has just happened today but i can test it when i get home
this ip situation is getting corrected tommorow
i tested a message earlier using my pickup folder and although the notepad file dissappeared nothing appeared in my hotmail.
i hope thats why they arent reaching me.
-
Sep 5th, 2005, 09:36 AM
#6
Frenzied Member
Re: send email from webform
If an exception isn't thrown then the message should have been sent.
Where is this script being executed? If it's on your local machine is an SMTP server installed? It might be worth changing localhost to the SMTP server you use for your email client.
DJ
If I have been helpful please rate my post. If I haven't tell me!
-
Sep 5th, 2005, 11:13 AM
#7
Thread Starter
Fanatic Member
Re: send email from webform
yeah no email is being sent,
no errors are thrown
i checked at home machine
im using smpt on iis i think
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|