Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Submit page with ASP

    I have the following code (at the bottom of the page).... I have several fields, name, address, phone, etc.... listed at the top. I recently had to switch my ASP submit page to send through SMTP, which I didn't have to do before, and now I can't get my fields to go into the message body. I have it written at the bottom "I want my text here"
    Can someone please help me, or point me in the right direction, as far as what code I can put there to get those fields into the email it sends? I'm pretty lost.
    Thanks,
    Jon



    <%@ Language="VBScript" %>

    <%
    strFirst=Request.Form("First Name")
    strLast=Request.Form("Last Name")
    strCompany=Request.Form("Company Name")
    strAddress=Request.Form("Address")
    strAddress2=Request.Form("address2")
    strCity=Request.Form("City")
    strState=Request.Form("State")
    strZip=Request.Form("Zip Code")
    strCountry=Request.Form("country")
    strPhone=Request.Form("phone")
    strFax=Request.Form("fax")
    strEmail=Request.Form("Email")
    strComments=Request.Form("comments")
    strTitle=Request.Form("Title")

    Const cdoSendUsingPort = 2
    Const cdoAnonymous = 0
    Const cdoBasic = 1
    Dim iMsg
    Dim iConf
    Dim Flds
    Dim strHTML

    set iMsg = CreateObject("CDO.Message")
    set iConf = CreateObject("CDO.Configuration")

    Set Flds = iConf.Fields

    ' Set the CDOSYS configuration fields to use port 25 on the SMTP server.

    With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
    'ToDo: Enter name or IP address of remote SMTP server.
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
    ' Specify the authentication mechanism to use.
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
    ' The username for authenticating to an SMTP server using basic (clear-text) authentication
    ' update this with a valid email account from your domain.
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "jon@panniergraphics.com"
    ' The password used to the email account noted above for sendusername
    'Password is Case SensitiVE
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "graphics"
    ' The port on which the SMTP service specified by the smtpserver field is listening for connections (typically 25)
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    .Update
    End With

    ' Apply the settings to the message.
    With iMsg
    Set .Configuration = iConf
    .To = "art@pannier.com" 'Enter a valid email address.
    .From = "jon@panniergraphics.com" 'Enter a valid email address.
    .Subject = "Info From Contact Us Page" 'enter subject
    .TextBody = "I want my text here"
    'enter message text/body
    .Send
    End With

    ' Clean up variables.
    Set iMsg = Nothing
    Set iConf = Nothing
    Set Flds = Nothing

    response.redirect "./thanks.asp?Title=contact&Subtitle=thanks"
    %>

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    865
    Thanks
    7
    Thanked 29 Times in 28 Posts
    Here is a ready made script that you can examine and perhaps customize to your liking

    http://www.codeproject.com/asp/sendmail.asp

    Cheers,
    Ess

  • #3
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I added the script, and it almost works right.
    I need to add on there to send through a remote SMTP server... but I can't quite seem to get it to work. I keep getting this error:

    Microsoft VBScript runtime error '800a01f4'

    Variable is undefined: 'cdoSendUsingPort'

    /mailer.asp, line 48

    Any ideas?
    Jon

  • #4
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Use numeric values instead of the constant values

    e.g.
    Code:
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    or set a constant
    Code:
    Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory. 
    Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network). 
    
    Const cdoAnonymous = 0 'Do not authenticate
    Const cdoBasic = 1 'basic (clear-text) authentication
    Const cdoNTLM = 2 'NTLM

  • #5
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm sorry, I really don't understand.
    I tried with the numeric values, and I got this error message:

    Microsoft VBScript runtime error '800a01f4'

    Variable is undefined: 'Flds'

    /mailer.asp, line 48


    I don't even know what to do with the constant codes.
    I'm a newbie, and really don't understand all of this at all. This is the last .asp page I can't get to work....

    Jon

  • #6
    dev
    dev is offline
    New Coder
    Join Date
    Jan 2007
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if u have to frame an Email u can use the following.

    Dim objMsg
    set objMsg = Server.CreateObject("CDONTS.NewMail")
    objMsg.From = <From mailid>
    objMsg.To = <To Mailid>
    objMsg.Subject = "Reg:Status of the Product"
    objMsg.MailFormat = 0
    objMsg.BodyFormat = 0

    'Framing contents for body for eg if u r printng Firstname within body then

    MailBody = MailBody & strFirst
    MailBody = MailBody & strLast

    'Like above u can concatenate the contents for the body and pass it as a single variable to objmsg.body.

    objMsg.Body=MailBody
    objMsg.send

    'Finally in the Mail in Body Part both firstname and Last name will get Printed.
    Check with sample and quote whatever necessary .

  • #7
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you are using Option Explicit then you have to define all used variables in your page.

  • #8
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I cannot figure this out. How can I find somone to freelance this work out to? I also want to change a couple other things, but can't seem to figure it out. I would like to get this stuff done soon... sooner than it will be if I have to figure it out.
    Any suggestions?
    Thanks,
    Jon

  • #9
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This forum and Aspfree have forums to request hired help.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •