View Single Post
  #3 (permalink)  
Old July 18th, 2006, 07:44 AM
Smythe Smythe is offline
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