Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Multiple field form for this ASP mailer script

Reply
Thread Tools

Multiple field form for this ASP mailer script

 
 
Mark Creelman
Guest
Posts: n/a
 
      04-03-2004



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 = ""
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>
--------------------------------------------------------------------------------------------------------

 
Reply With Quote
 
 
 
 
Steven Burn
Guest
Posts: n/a
 
      04-03-2004
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 <> wrote in message
news:...
>
>
>
> 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 = ""
> 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>
> --------------------------------------------------------------------------

------------------------------
>



 
Reply With Quote
 
 
 
 
Mark Creelman
Guest
Posts: n/a
 
      04-03-2004


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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Reply With Quote
 
Steven Burn
Guest
Posts: n/a
 
      04-03-2004
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)


Mark Creelman <> wrote in message
news:...
>
>
> 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
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: [sendmail,perl] How to catch a mailer error [perl script as sendmail.cf mailer] Andrzej Adam Filip Perl 0 03-31-2008 09:24 PM
Mailer, Newsletter script in asp/asp.net =?Utf-8?B?Sm9l?= ASP .Net 1 02-23-2005 10:33 PM
copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation - how to overcome? NotGiven Javascript 3 05-13-2004 12:15 AM
copy and paste form RTF document into field in asp form cause it to bypass field length and javascript validation - how to overcome? NotGiven ASP General 3 05-13-2004 12:15 AM
Script Request - form mailer with ID Number gwmbox Perl Misc 0 07-09-2003 12:19 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57