Creating a user email confirmation [Answered]RSS

14 replies

Last post Jul 08, 2009 07:10 AM by tomkmvp

  • Creating a user email confirmation

    Jul 06, 2009 11:36 AM|microsvc|LINK

    I have a form that passes it's form data to an asp page that processes and sends email.
    One of the forlds in the form is named "Email".  The webmaster also gets a copy of this email, but I need the value in an input field (which the email asp page reads) to match the users email address input.  The form input line reads this:

    <input name="recipients" type="hidden" value="webmaster@domain.com,<%=Request.Form("Email")%>" />

    Thanks!
    ~Bob

  • Re: Creating a user email confirmation

    Jul 06, 2009 12:10 PM|tomkmvp|LINK

    I'm having trouble understanding what you need.  Could you explain it differently or with more detail?

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: Creating a user email confirmation

    Jul 06, 2009 01:29 PM|microsvc|LINK

    Essentially I'm taking the value from an input, and placing it into another value on another input which is hidden and the value is used for email address recipients.  The value of that hidden field has email addresses seperated by commas.  I need the email address the user entered to be copied to the hidden value.  I hope this makes more sense.

     BTW: I'm from NJ and moved to Joklahoma 2 years ago.

  • Re: Creating a user email confirmation

    Jul 06, 2009 03:58 PM|tomkmvp|LINK

    The code you show looks good to me.

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: Creating a user email confirmation

    Jul 06, 2009 04:19 PM|microsvc|LINK

    I thought it was, but when I submit the form, I get an Invalid email address message.

  • Re: Creating a user email confirmation

    Jul 07, 2009 07:03 AM|tomkmvp|LINK

    What does the resulting HTML show for the input tag?  Should the addresses be comma or semi-colon delimited?

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: Creating a user email confirmation

    Jul 07, 2009 09:16 AM|microsvc|LINK

    The result from the formmail.asp page is "No email recipient(s) specified"

    The seperator is comma between the emails as I have other forms with multiple email addresses seperated by commas.

     Thanks!

  • Re: Creating a user email confirmation

    Jul 07, 2009 10:51 AM|tomkmvp|LINK

    microsvc

    The result from the formmail.asp page is "No email recipient(s) specified"

    No ... I mean what HTML does this create?
    <input name="recipients" type="hidden" value="webmaster@domain.com,<%=Request.Form("Email")%>" />

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: Creating a user email confirmation

    Jul 07, 2009 12:13 PM|microsvc|LINK

    <input name="recipients" type="hidden" value="webmaster@anydomain.com," />

     Looks like the ASP code is omitted from the value.  It should be after the comma.

  • Re: Creating a user email confirmation

    Jul 07, 2009 01:45 PM|tomkmvp|LINK

    On the initial form tag, is the method GET or POST?  If it's GET, you need to use Request.QueryString("Email") ... Request.Form only works with POST.

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: Creating a user email confirmation

    Jul 07, 2009 03:45 PM|microsvc|LINK

    The method is post. 

  • Re: Creating a user email confirmation

    Jul 07, 2009 04:37 PM|tomkmvp|LINK

    We must be missing something then ... I need more details. What are all the pages involved with what forms, what page is that code on, and in what sequence are the pages processed?

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/
  • Re: Creating a user email confirmation

    Jul 07, 2009 05:28 PM|microsvc|LINK

    Heres the part of the form - some irrelevant stuff snipped
    Note, this form works and emails me then adds the data to my access database done by formmailDB.asp.  I just need to add the users email address to the "recepients" entered in the form as a confirmation to him.  Thanks!

    <form name="EquipmentRequest" language="Javascript" "action="formmailDb.asp" method="post">
       
    <div align="center">
    <!-- Additional recipients seperated by comma -->
    <input name="recipients" type="hidden" value="user@anydomain.edu,<%= Request.Form("Email") %>" />

    <input name="subject" type="hidden" value="Equipment Request Form" />
    <input name="replyToField" type="hidden" value="webmaster@stgregorys.edu" />
    <!-- Start of Form fields :: Required Fields below -->
    <input name="requiredFields" type="hidden" value="Requestor,Email,Equipment,NeedLocation" />

    This is a row from the table in the form
    <tr>
        <td align="right" style="width: 294px">Email address:</td>
        <td style="width: 294px">
        <input type="text" name="Email" size="32" tabindex="2" />
        </td>
    </tr>

    <input type="submit" value="Submit" />
    </form>

  • Re: Creating a user email confirmation

    Jul 08, 2009 02:51 AM|salman_arshad|LINK

    If I am understanding correctly, you are asking the user to enter an email address and you want to send an email to the specified email address + another, hidden email address. In this case you can call the email function twice, specifying two different values for the "To" field. Alternatively you can add one recipient to the "To" field, and the other one to the "CC" or "BCC" field. The form might look like:

    <input type="text" name="Email" size="32" tabindex="2" />

    There is no need to echo the user@anydomain.edu in the form. Process this part on the server side.

    The server side handler for the form should include email code that goes along these lines (using CDO.Message class):

    <div style="margin-left: 40px;"> dim oMSG
    set oMSG = CreateObject( "CDO.MESSAGE" )

    'UNCOMMENT FOLLOWING IF YOU ARE SENDING MAIL THROUGH SMTP SERVER
    'oMSG.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    'oMSG.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "external-smtp-server-name.com.or-its-ip"
    'oMSG.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    'oMSG.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "smtp-logon-username-here"
    'oMSG.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "smtp-logon-password-here"
    'oMSG.Configuration.Fields.Update

    oMSG.From = "no-reply@anydomain.com"
    oMSG.To = Request.Form("Email")
    oMSG.BCC = "address-that-receivces-a-copy@anydomain.edu"
    oMSG.Subject = "Thank you"

    oMSG.TextBody = "Message text goes here"
    ' -- OR --
    oMSG.HTMLBody = "Message html goes here"

    on error resume next
        oMSG.Send
        if Err.number <> 0 then
            'OOPS, SEND METHOD FAILED
        end if
    on error goto 0
    set oMSG = nothing

    </div>

    ASP CDO asp classic cdo.message send mail smtp

  • Re: Creating a user email confirmation

    Jul 08, 2009 07:10 AM|tomkmvp|LINK

    In your case you can't use Request.Form("Email") on the same page as <input name="Email" /> because Request.Form is not populated until the form is submitted.

    Just reference Request.Form("Email") in your code on formmailDB.asp where you need to specify the recipient (along with the webmaster address) for the return email.

    Tom Kaminski (former IIS MVP 2002-2010)
    http://mvp.support.microsoft.com/