Skip to main content
March 12, 2007
Question

Send Email after Insert Record

  • March 12, 2007
  • 1 reply
  • 478 views
I am by no means a coder so please be gental. I have a contact page that I have insert into a database, but I am also trying to send an email after it inserts into the db. But I cant seem how to make it work. Dreamweaver wrote the code for the insert and I am not sure were to go from here. I am using asp vb. thnaks
This topic has been closed for replies.

1 reply

Inspiring
March 12, 2007
On 11 Mar 2007 in macromedia.dreamweaver.appdev, jeremy12345 wrote:

> I am by no means a coder so please be gental. I have a contact page
> that I have insert into a database, but I am also trying to send an
> email after it inserts into the db. But I cant seem how to make it
> work. Dreamweaver wrote the code for the insert and I am not sure
> were to go from here. I am using asp vb.

See all those Request.Form("nameSuffix") and similar? They contain the
information posted from the form, and are still available to you after
the database has been populated.

What you need to do:
- Find out from your hosting provider what mail component(s) are
available on your server.
- Create an email using the information from the form:
<%
DIM MyEMailBody, MyEMail

MyEMailBody = "Name: " & Request.Form("nameFirst") & " "
MyEMailBody = MyEMailBody & Request.Form("nameMiddle") & " "
MyEMailBody = MyEMailBody & Request.Form("nameLast") & VBCrLf
' VBCrLf is a CarriageReturn/LineFeed (ie a new line)
' ...
' Details Below will vary depending on the mailer component
MyEMail = CreateObject("CDONTS.NewMail")
MyEMail.From = "webform@example.com"
MyEMail.To = "jeremy12345@example.com"
MyEMail.Subject = "Inserted Record"
MyEMail.Body = MyEMailBody
' Send the email
MyEMail.Send
' Get rid of the email on the server
SET MyEMail = nothing
%>
--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
Inspiring
March 13, 2007
On 12 Mar 2007 in macromedia.dreamweaver.appdev, jeremy12345 wrote:

> I found a tutoiral similiar and for kicks I tried it and it worked.
> But what I really want to do not to be a pain is to send the email
> on a second asp page with other script unlsess you can help me
> figure out how to do it all on the same page.

<%
' Code to enter record into database goes here
' ...
%>
<%
' Code to send email goes here
' ...
%>
<!-- HTML Code, if any, goes here -->

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php