Hi Magda,
This really all depends on which mailing components are available to you on
your server, and which database/programming language you are using. If you
would like to see all of the components available to you on your server,
copy and paste the following code into an ASP page, upload it to your server
and run the code by opening the page.
<% @ Language="VBScript" %>
<% Option Explicit %>
<%
Dim theComponents(18)
theComponents(0) = Array("ABMailer.Mailman", "ABMailer v2.2+")
theComponents(1) = Array("Persits.MailSender", "ASPEMail")
theComponents(2) = Array("SMTPsvg.Mailer", "ASPMail")
theComponents(3) = Array("SMTPsvg.Mailer", "ASPQMail")
theComponents(4) = Array("CDONTS.NewMail", "CDONTS (IIS 3/4/5)")
theComponents(5) = Array("CDONTS.NewMail", "Chili!Mail (Chili!Soft ASP)")
theComponents(6) = Array("CDO.Message", "CDOSYS (IIS 5/5.1/6)")
theComponents(7) = Array("dkQmail.Qmail", "dkQMail")
theComponents(8) = Array("Dundas.Mailer", "Dundas Mail (QuickSend)")
theComponents(9) = Array("Dundas.Mailer", "Dundas Mail (SendMail)")
theComponents(10) = Array("Geocel.Mailer", "GeoCel")
theComponents(11) = Array("iismail.iismail.1", "IISMail")
theComponents(12) = Array("Jmail.smtpmail", "JMail")
theComponents(13) = Array("MDUserCom.MDUser", "MDaemon")
theComponents(14) = Array("ASPMail.ASPMailCtrl.1", "OCXMail")
theComponents(15) = Array("ocxQmail.ocxQmailCtrl.1", "OCXQMail")
theComponents(16) = Array("SoftArtisans.SMTPMail", "SA-Smtp Mail")
theComponents(17) = Array("SmtpMail.SmtpMail.1", "SMTP")
theComponents(18) = Array("VSEmail.SMTPSendMail", "VSEmail")
Function IsObjInstalled(strClassString)
On Error Resume Next
'// Initialize default values
IsObjInstalled = False
Err = 0
'// Testing code
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
'// Cleanup
Set xTestObj = Nothing
Err = 0
On Error Goto 0
End Function
Response.Write "<html>" & vbNewLine & _
vbNewLine & _
"<head>" & vbNewLine & _
" <title>E-mail Component Test</title>" &
vbNewLine & _
"</head>" & vbNewLine & _
vbNewLine & _
"<body bgColor=doublequotewhitedoublequote
text=doublequotemidnightbluedoublequote link=doublequotedarkbluedoublequote
aLink=doublequotereddoublequote vLink=doublequotereddoublequote>" &
vbNewLine & _
"<font face=doublequoteVerdana, Arial,
Helveticadoublequote>" & vbNewLine & _
"<table border=doublequote0doublequote
cellspacing=doublequote0doublequote cellpadding=doublequote0doublequote
align=doublequotecenterdoublequote>" & vbNewLine & _
" <tr valign=doublequotetopdoublequote>" &
vbNewLine & _
" <td
bgcolor=doublequoteblackdoublequote>" & vbNewLine & _
" <table
border=doublequote0doublequote cellspacing=doublequote1doublequote
cellpadding=doublequote4doublequote>" & vbNewLine & _
" <tr
valign=doublequotetopdoublequote>" & vbNewLine & _
" <td
bgcolor=doublequotemidnightbluedoublequote colspan=doublequote2doublequote
align=doublequotecenterdoublequote><font size=doublequote2doublequote
color=doublequotemintcreamdoublequote><b>E-mail Component
Test</b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine
Dim i
For i = 0 To UBound(theComponents)
Response.Write " <tr>" & vbNewLine & _
" <td
bgColor=doublequote#9FAFDFdoublequote
align=doublequoterightdoublequote><font
size=doublequote2doublequote><strong>" & theComponents(i)(1) &
": </strong></font></td>" & vbNewLine & _
" <td
bgColor=doublequote#9FAFDFdoublequote
align=doublequotecenterdoublequote><font size=doublequote2doublequote>"
If Not IsObjInstalled(theComponents(i)(0)) Then
Response.Write("not installed")
Else
Response.Write("<strong>installed!</strong>")
End If
Response.Write "</font></td>" & vbNewLine & _
" </tr>" & vbNewline
Next
Response.Write " </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>" & vbNewLine & _
"</font>" & vbNewLine & _
"</body>" & vbNewLine & _
vbNewLine & _
"</html>" & vbNewLine
%>
Sorry for the messy code, it was copy and pasted from a website. For the
original, see
http://www.aspit.net/code/miscellaneous/check_installed_email_components.asp
Once you know which component you will use, you will want to create the
additional code needed to add a new record to the database. In the following
example, assume that there is a form on the page with two fields, "Name" and
"Email":
<% @ Language="VBScript" %>
<% Option Explicit %>
<%
'Check if form has been submitted
If Request("Submit") <> "" Then
'Pass form values into variables
Dim varFormName
Dim varFormEmail
'Retrieve form values
varFormName = CStr(Request("Name"))
varFormEmail = CStr(Request("Email"))
'Trim extra spaces
varFormName = Trim(varFormName)
varFormEmail = Trim(varFormEmail)
'start INSERT command
'You can either use a hand-coded INSERT here,
'or use the built in Macromedia INSERT behavior.
'If using the built in behavior, ensure that you
'enter the following code BEFORE the redirect line
'but AFTER the INSERT command executes.
'end INSERT command
'start email script
'NOTE: the code that goes here is dependant on which component you
use
'simply pass varFormName and varFormEmail into the email message
'end email script
'If you used the built in Macromedia INSERT behavior,
'then place the Response.Redirect line here. Otherwise
'you can place your own Response.Redirect here.
Response.Redirect("redirectpage.asp")
End If 'If Request("Submit") <> "" Then
%>
Just a simple way to do it - it may/may not work for you, but I use it
without any problems at all.
Mark Bieganek
-----Original Message-----
From: Magda Karoni [mailto:mkaroni@...]
Sent: Tuesday, October 12, 2004 3:02 AM
To: BKWeb_UltraDev@yahoogroups.com
Subject: [BKWeb_UltraDev] email and database
Hi Everybody
does anybody knows of a code that will allow the form to send an email and
at the same time write the info on a database or a table.
Thanks
Magda
[Non-text portions of this message have been removed]
Yahoo! Groups Links