automatic email notification of online form submission

G

Guest

I have a database application that is submitted to an Access database. What
I want is when the form is submitted to automatically send an email to
multiple persons with the info from the form. This could be as an
attachement or plain text. I wouldn't care if it was like the mailto. I'm
clueless on how to do this.
Any help would be greatly appreciated.
 
K

Karl Seguin

Look at the System.Web.Mail namespace

it's pretty easy, check out: http://www.aspheute.com/english/20000918.asp

basically create a new MailMessage, set all the properties (To, From,
Subject, Body) and use the Attachments.Add to point to the file to attach.

before doing a SmtpMail.Send though, you might need to do
SmtpMail.SmtpServer ="SMTP_SERVER_ADDRESS"

I think by default it looks for an smtp server on the same machine as your
web site, which is probably what you want.

Karl
 
G

Guest

Thanks for your quick response karl.
Forgive me but I'm new to this stuff. I've looked at this before and didn't
really know how to implement this code. Is this from the CodeBehind or the
html
output?
 
G

Guest

that sample is in the HTML view, but you can easily do this from the
codebehind in the button click event
 
G

Guest

I tried the code behind and got
COMException (0x80040213): The transport failed to connect to the server

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

When I use my own server domain it gives me
550 5.7.1 Unable to relay for " "



:
 
K

Karl Seguin

Where is your smtp serve rrunning?

As I said in my original post, you'll likely have to specify the address of
the SMTP server via SmtpMail.SmtpServer

IIS has an smtp server built-in, perhaps you need to start the service?
(simple mail transfer protocol I believe it's called), and point your
SmtpServer to 127.0.0.1 (local)

karl
 

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

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top