Steven
Wed Mar 30 12:39:56 CST 2005
<%
'// Example.asp
'// Assumes:
'//
'// 1. You have CDO support
'// 2. You have a dedicated mail server
'// 3. You are not blocking port 25
'// Consts
Const sMailTo =3D "someone@example.com"
Const sMailServer =3D "your.mailserver.com"
lConfirmSend =3D Request.Querystring("bConf")
If NOT IsNumeric(Clng(lConfirmSend)) Then lConfirmSend =3D ""
Select Case Clng(lConfirmSend)
Case 1 '// Send the mail
sSenderName =3D Request.Form("sSenderName")
sSenderMail =3D Request.Form("sSenderMail")
sSenderComments =3D Request.Form("sSenderComments")
Dim objCDO, strFrom, strFromMail, strTo, strToMail, =
strSubject, strBody
strSubject =3D "Mail sent from: " & =
Request.ServerVariables("SERVER_NAME")
strFromName =3D Trim(sSenderName): strFromEMail =3D =
Trim(sSenderMail)
strBody =3D sSenderComments
sch =3D "
http://schemas.microsoft.com/cdo/configuration/"=20
Set cdoConfig =3D CreateObject("CDO.Configuration")=20
With cdoConfig.Fields=20
.Item(sch & "sendusing") =3D 2 '// cdoSendUsingPort=20
.Item(sch & "smtpserver") =3D sMailServer=20
.update=20
End With=20
Set cdoMessage =3D CreateObject("CDO.Message")=20
With cdoMessage
Set .Configuration =3D cdoConfig
.From =3D strFromName & " <" & strFromEMail & ">"
.To =3D sMailTo
.Subject =3D strSubject
.TextBody =3D strBody
.Send
End With
Set cdoMessage =3D Nothing
Set cdoConfig =3D Nothing
Case Else '// Show your form
%>
<form action=3D"example.asp?bConf=3D1" method=3D"post" =
name=3D"frmSendMail">
<input type=3D"text" name=3D"sSenderName" value=3D"Your =
name"><br>
<input type=3D"text" name=3D"sSenderMail" value=3D"Your =
E-mail"><br>
<input type=3D"text" name=3D"sSenderComments" value=3D"Your =
comments"><br>
</form>
<%
End Select
%>
--=20
Regards
Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk
Keeping it FREE!
"xplusx" <xplusx@discussions.microsoft.com> wrote in message =
news:AE408E60-7F72-463B-967D-A06B50595C40@microsoft.com...
> I was tasked to create a form that will send email to selected =
addresses. Can=20
> somebody provide me a step by step how tos?
>=20
> Im not sure if im on the right channel, but...Thanks a lot