Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 17th, 2006, 12:20 PM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Wondering how I'd go about doing this

I'm very new to ASP(as in first time ever using it) and I'm trying to create a page that will allow a person to email someone within our company.

Everything works fine and dandy, but when it comes to the comments section it just prints out as one large paragraph.

and what I need it to do is something that looks like this.

Line 1

Line 2
Line 3

I've tried putting in "<br><br> as it's a HTMLBody but doesn't seem to be doing the trick. What is my best way of doing this..

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old July 17th, 2006, 06:38 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Use vbclf if its not an HTML type email. You can only use a <bR> if its an HTML email you arw sending

Wind is your friend
Matt
Reply With Quote
  #3 (permalink)  
Old July 18th, 2006, 08:44 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

well it is an HTML email that we are sending from the page, and what we're trying to get it is if the user enters in more then one paragraph that it doesn't get sent as one giant block of text. Here's the code for the actual scripting.


Code:
<%@ Language=VBScript %>
<%  'Written By - JR %>
<%
    Dim Mailer
    Dim iConf
    Dim Flds

    webaddr=Request.QueryString("pageref")
    'Check for missing fields
    Dim sCheckFailed
    'If Request.Form("emto") = "" then sCheckFailed = sCheckFailed & "0FN"
    'If Request.Form("emfrom") = "" then sCheckFailed = sCheckFailed & "0LN"

    'If sCheckFailed <> "" then Response.Redirect(Request.Form("Page") & "?rem=" & sCheckFailed & "&" & Request.Form)

    'Check for valid email address

        '-- contains a @
    EmailValid3 = false
    For x = 1 to Len(Request.Form("emfrom")) 
        If mid(Request.Form("emfrom"),x,1) = "@" Then
            EmailValid3 = true
        End If
    Next

    '-- contains a .
    EmailValid4 = false
    For x = 1 to Len(Request.Form("emfrom")) 
        If mid(Request.Form("emfrom"),x,1) = "." Then
            EmailValid4 = true
        End If
    Next



    If EmailValid3 = False OR EmailValid4 = False Then
        'Response.Redirect(Request.Form("Page") & "?rem=0EM&" & Request.Form)
        Response.Redirect(webaddr)
        SubmitEmail="jwright@septimatech.com"
    else

    'All is good send the email

    Set Mailer = Server.CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields

    Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1

    '**** Path below may need to be changed if it is not correct
    'Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
    'Flds.Update

    Set Mailer.Configuration = iConf



    Mailer.From = Request.Form("emfrom")
    Mailer.to =   Request.Form("emto")
    Mailer.Subject = "Website Email"
    Mailer.HTMLBody =  Request.Form("emailComments") & "<br><br></br></br>" & _
    Request.Form("emname") & "<br><br></br></br>" & Request.Form("emphone")

    Mailer.Send

    Set mailer = Nothing
    Response.Redirect("/index.htm") 
    end if
    %>
Reply With Quote
  #4 (permalink)  
Old July 18th, 2006, 01:38 PM
Registered User
 
Join Date: Jul 2006
Location: Cincinnati, OH, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So, if a user enters a line break, you want to preserve it when the email is generated, right?

To do so, you need to convert Chr(13) to <BR> since you're sending an email using CDOSYS's .HTMLBody.

So, for example:

Code:
Dim strUserComments
strUserComments = Request.Form("emailComments")
If Len(strUserComments) > 1 Then
   strUserComments = Replace(strUserComments,Chr(13),"<br>")
End If
What this does is converts the carriage return character to the HTML <br> or line-break tag.

So, when calling objYourObject.HTMLBody = blah & strUserComments

the <br> will be included in the output email.




Reply With Quote
  #5 (permalink)  
Old July 19th, 2006, 12:59 PM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

So using the above it should look something like this then?

Mailer.HTMLBody = Request.Form("emailComments") & strUserComments

Cause if that's the case then it's not adding in the hard-return..:(
Reply With Quote
  #6 (permalink)  
Old July 19th, 2006, 01:16 PM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

nvm...got it..just forgot to remove something else that wasn't working

Reply With Quote
  #7 (permalink)  
Old July 19th, 2006, 02:48 PM
Registered User
 
Join Date: Jul 2006
Location: Cincinnati, OH, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did this do the trick then?

Reply With Quote
  #8 (permalink)  
Old July 20th, 2006, 09:17 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes it did thank you..

Reply With Quote
  #9 (permalink)  
Old July 20th, 2006, 09:28 AM
Registered User
 
Join Date: Jul 2006
Location: Cincinnati, OH, USA.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Not a problem, glad to be of assistance. :)

Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wondering why .UDL for connecting string shailu BOOK: Beginning ASP 3.0 3 May 17th, 2005 08:39 AM
Chapter 5 page 150 - Wondering why.... potassium Beginning PHP 3 July 27th, 2003 01:05 AM



All times are GMT -4. The time now is 03:05 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.