Results 1 to 2 of 2

Thread: Form to Mail ASP

  1. #1
    Join Date
    Mar 2011
    Thanked 0 Times in 0 Posts

    Default Form to Mail ASP


    Im having a little difficulty with a E-mail form in ASP. It sends to my E-mail just fine but the responses when filling out the form do not appear in the e-mail, the e-mail is just blank. Can somebody help me out with the coding please?

    This coding is on the actual asp form page..

    <FORM ACTION="formtomail.asp" METHOD="post">
    <p align="center">
    <span class="style12">Name : </span>
    <input type="text" size="51" maxlength="256" name="Name" style="width: 264px"><p align="center">
    <span class="style12">E-mail : </span>
    <input type="text" size="48" maxlength="256" name="Email" style="width: 266px"><p align="center">
    <INPUT TYPE=submit value="Submit">
    This is the page the form sends all the infomation to..


    Const cdoBasic = 1 'Use basic (clear-text) authentication.
    Const cdoSendUsingPort = 2
    'cdosys related
    Dim iMsg
    Dim iConf
    Dim Flds
    'mail related
    Dim strMsg
    Dim strTo
    Dim strCC
    Dim strFrom
    Dim strSubject
    Dim strTextBody

    '==================begin your configuration=============================
    'you must have a username and pass word or you will not be able to send
    Dim sendusername : sendusername = ""
    Dim userpassword : userpassword = ""
    Dim smtpserver : smtpserver = ""
    'end your configuration

    '===================begin set your info here============================
    'set your TO, CC, From, Subject and body here
    strTo = ""
    strCC = ""
    strFrom = ""
    strSubject = "My Cheap Travel Quotes"
    strTextBody = ""
    'end set your info here

    'Create message and configuration objects
    set iMsg = CreateObject("CDO.Message")
    set iConf = CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields
    'Apply settings to the configuration object
    With Flds
    ' Specify the authentication mechanism to basic (clear-text) authentication.
    .Item("") = cdoBasic
    ' The username for authenticating to an SMTP server
    .Item("") = sendusername
    ' The password used to authenticate to an SMTP server
    .Item("") = userpassword
    ' Port
    .Item("") = cdoSendUsingPort
    'Specify mail server
    .Item("") = smtpserver
    'Specify the timeout in seconds
    .Item("") = 10
    ' The port on which the SMTP service specified by the smtpserver field is listening for connections (typically 25)
    .Item("") = 25
    'Use SSL for the connection (False or True)
    '.Item("") = False
    End With

    'Apply the settings to the message object and send it
    With iMsg
    Set.Configuration = iConf
    .To = strTo
    .From = strFrom
    If strCC <> "" Then
    .CC = strCC
    End If
    .Subject = strSubject
    .TextBody = strTextBody
    'Send message
    End With
    ' cleanup mail objects
    Set iMsg = Nothing
    Set iConf = Nothing
    Set Flds = Nothing
    Can somebody please let me know why it is not sending the information that is posted on the form to my e-mail is something not coded properly? Thanks in advance!

  2. #2
    Join Date
    Feb 2011
    Thanked 1 Time in 1 Post


    this is not valid:


    They must be assigned to variables

    you also do not have any value assigned to the variable "strTextBody" so the email content is blank


Posting Permissions

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