Formail in ASP.NET

Discussion in 'Classic ASP' started by LayLay, Jun 30, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. After having searched through the net for days, I can't seem to find the answer to my doubt on Formail in ASP format and in hope that I could obtain answer/ suggestion/ guidance/ advise to my issue in this forum.... :confused:

    First of all, I am a newbie to Formail; regardless of in what format. Currently, I am using MS visual web developer 2008 to create my 'Contact Us' page. The page is to collect the name, e-mail and comments from visitors to my site. After having pressed the submit button, the information is then e-mailed to me and then thanking the visitor for his/ her comments by displaying another page. :rolleyes:

    In order to achieve my goal above, I manage to download a formail.asp and integrate it to my 'Contact US' page but apparently the integration is not successful....... no redirection for a start after the 'Submit' button is pressed, except the page seems to be refreshed only..... :(

    You may check out that page at http://laylayuniverse.com/Contact_Us.aspx .... for a clearer picture....:confused:

    Thanks in advanced! :)
     
  2. Whats the SMTP server you are using for your formmail?
     
  3. Thank you for your reply!:)

    I've just checked out my web server type is Windows 2008 - IIS 7.0. and my web site is currently being hosted by your company; \DiscountASP.NET.

    Does that answer your question? If not please do guide me to retreive the right answer for you as I am also new to your company.... :eek:
     
  4. Hmm... now your question leads me to another doubt.... Besides the need to place the formail.asp at the root of directory, can I use other smtp to execute the formail.asp or I should not do that??? :confused:

    I am trying to learn all this in an intensive manner if at all possible so I welcome whatever guidance that any one can offer in this forum :rolleyes:

    Many thanks! :)
     
  5. Can you copy and past your formail code on this thread? I'm thinking that you are not using the correct email server to send out email.
     
  6. I've uploaded the formail.asp file as an attachment to this reply...

    <%@ LANGUAGE="VBScript" %>
    <% '**************************************************************************
    '* ASP FormMail *
    '* *
    '* Do not remove this notice. *
    '* *
    '* Copyright 1999-2008 by Mike Hall. *
    '* Please see http://www.brainjar.com for documentation and terms of use. *
    '**************************************************************************

    '- Customization of these values is required, see documentation. ----------

    mailComp = "ASPMail"
    smtpServer = "auth.smtp.1and1.co.uk"
    ' fromAddr = "[email protected]"
    fromAddr = "[email protected]"

    The lines as in RED at the start of the script, if I get it right I need to modified both in order to adapt the script to my server but then how??? If possible may be by example??:confused:

    As of HTML elements are authored as follows which you might have taken note on...-------------------------
    <input type="hidden" name="_recipients" value="[email protected]" />
    <input type="hidden" name="redirect-to" value="<%#Page.ResolveUrl("Thank_You.aspx")%>" />

    <input name="_requiredFields" type="hidden" value="Name,Email,Comments" />

    <input name="_redirectUrl" type="hidden" value="Thank_You.aspx" />

    <label for="Name">Name: </label><input name="Name" type="text" id="Name" maxlength="50" size="40" /><br />
    <label for="Email">Email: </label><input name="Email" type="text" id="Email" maxlength="50" size="40" /><br />
    <label for="Comments">Comments:</label>
    <br />
    <textarea name="Comments" rows=10 cols=40 id="Comments"></textarea><br/>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="submit" value="Submit" />
    <input type="reset" value="Clear" />

    -------------------------
    Generally, am I doing it in the right way? :confused:

    Hope to hear from your soon! Many thanks! :rolleyes:
     
  7. This is difficult to troubleshoot because it involves a outside mail server. For something like this I recommend that you contact the email administrator for 'auth.smtp.1and1.co.uk' and have them check their smtp log to see if the message was relayed correctly.

    As an alternative, it maybe easier to use our web servers smtp service to relay out email with your formmail. The server name would be 'localhost'.
     
  8. Hi Raymond,

    Just wonder will the below setup setting works for formail.asp; by running the script in the server?? :confused:

    smtpServer = "localhost"
    fromAddr = "[email protected]"

    Hope to hear from you soon! ;)
     
  9. Hi,
    Pasted below is a fully functional Classic ASP Contact page running on one of my servers here...Just change the Email addresses and it will work for you:

    --BEGIN-----------------------------------------------------------------

    <%
    strHost = "localhost"
    If Request("Send") <> "" Then
    Set Mail = Server.CreateObject("Persits.MailSender")
    Mail.Host = strHost
    Mail.From = Request("From") ' From address
    Mail.FromName = Request("FromName") ' optional
    Mail.AddAddress "[email protected]", "Mark" 'Request("To")
    Mail.Subject = "Contact page" 'Request("Subject")
    Mail.Body = Request("Body")
    strErr = ""
    bSuccess = False
    On Error Resume Next
    Mail.Send
    If Err <> 0 Then
    strErr = Err.Description
    else
    bSuccess = True
    End If
    End If
    %>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>Contact</title></head>
    <body bgcolor="#FFFFFF">
    <% If strErr <> "" Then %>
    <h3>Error occurred: <% = strErr %></h3>
    <% End If %>
    <% If bSuccess Then %>
    <center><b>Success!</b> Message sent.</center>
    <% End If %>
    <form method="post" action="contact.asp">
    <center>
    <table cellspacing="0" cellpadding="2" width="550" bgcolor="#E0E0E0">
    <tr>
    <td>&nbsp;</td>
    <td align="center"><b>Contact form</b></td>
    </tr>
    <tr>
    <td>Your Email:</td>
    <td><input type="text" name="From" size="50" maxlength="50" /></td>
    </tr>
    <tr>
    <td>Your Name:</td>
    <td><input type="text" name="FromName" size="50" maxlength="50" /></td>
    </tr>
    <tr>
    <td>Message:</td>
    <td><textarea name="Body" cols="40" rows="10"></textarea></td>
    </tr>
    <tr>
    <td colspan="2" align="center"><input type="submit" name="Send" value="Send Message" /></td>
    </tr>
    </table>
    </center>
    </form>
    </body>
    </html>

    --END-----------------------------------------------------------------
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page