Multiple field form for this ASP mailer script

M

Mark Creelman

Hello all:

How do I convert this ASP mailer script to accept and mail multiple fields of a form. This will do one field only
)iMesg.TextBody = Request.Form("body") and it works great.

Seems pretty simple, but I am missing it.


NOTE: Server uses "CDO" ONLY. (Not CDONTS)


Thankyou for your response.

Mark



------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<html>
<body>
<!--metadata type="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D" name="CDO for Windows 2000 Type Library" -->
<%

On Error Resume Next

'Execute main code only if a message was submitted
If Request.Form("send") <> "" Then


Set iConf = CreateObject ("CDO.Configuration")
Set Flds = iConf.Fields
'Set and update fields properties
Flds(cdoSendUsingMethod) = cdoSendUsingPort
Flds(cdoSMTPServer) = "mail.yourserver.net"
Flds.Update

Set iMesg = CreateObject("CDO.Message")
Set iMesg.Configuration = iConf

'Format and send message
Err.Clear

iMesg.To = "(e-mail address removed)"
iMesg.From = Request.Form("from")
iMesg.Subject = Request.Form("subject")
iMesg.TextBody = Request.Form("body")
iMesg.Send

If Err.Number = 0 Then


Result = "Message sent"

Else

Result = "Message not sent"

End If

End If
%>

<h1>CDO Test</h1>

<p>
<% Response.Write Result %>

<form method=post>

From: <input type=text name=from>

<p>
Subject: <input type=text name=subject>

<p>
Message: <br>
<textarea name=body>Enter your message here.</textarea>

<p>
<input type=submit name=send value="Send">

</form>

</body>
</html>
--------------------------------------------------------------------------------------------------------
 
S

Steven Burn

http://aspfaq.com/show.asp?id=2026

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)


Mark Creelman said:
Hello all:

How do I convert this ASP mailer script to accept and mail multiple fields
of a form. This will do one field only
)iMesg.TextBody = Request.Form("body") and it works great.

Seems pretty simple, but I am missing it.


NOTE: Server uses "CDO" ONLY. (Not CDONTS)


Thankyou for your response.

Mark



-------------------------------------------------------------------------- ----------------------------------------------------------------------------
------------------------------------

<html>
<body>
<!--metadata type="typelib" UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
name="CDO for Windows 2000 Type Library" -->
 
M

Mark Creelman

Hi:

Yes, that script does just what my first one does. I need to be able to
modify it so that I can have multiple fields.

Thanks,
Mark
 
S

Steven Burn

Just change;

iMesg.TextBody = Request.Form("body")

to;

str1 = request.form("box1")
str2 = request.form("box2")
.....
.....
etc etc

and;

iMesg.TextBody = str1 & vbcrlf & str2 & vbcrlf & str3 & vbcrlf...... etc etc

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
 

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

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top