SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2012
    Location
    US
    Posts
    142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help with ASP Contact form?

    I recently helped a friend move their site to a new host. After doing so their contact form throws a 500 error on submit. The data center said it was because it needs SMTP authentication. I do not know anything about ASP. Would someone mind looking at the code and offer advice or a snippet I could plug in? I could possible pay a few dollars if need be, Im just really in a bind....
    HTML Code:
    <%	pagetitle="McCausland Incorporated | Contact"
    	pagemetadescription=""
    	pagemetakeywords="" %>
    <!-- #INCLUDE FILE="_head.asp" -->
    
    <%	task=trim(request("task"))
    
    	select case task
    		case "submit"
    			pname=trim(request("pname"))
    			phone=trim(request("phone"))
    			email=trim(request("email"))
    			comments=trim(request("comments"))
    
    			if pname="" or email="" or comments="" then %>
    				<script language="javascript" type="text/javascript">
    					alert ("One or more required fields were not filled in.");
    				</script>
    <%				task=""
    			else
    				if instr(email,"@")>=instrrev(email,".") or instr(email,"@")=0 or instr(email,".")=0 then %>
    					<script language="javascript" type="text/javascript">
    						alert ("You have entered an invalid e-mail address.");
    					</script>
    <%					task=""
    				else
    					if instr(pname, "http://")>0 or instr(phone, "http://")>0 or instr(email, "http://")>0 or instr(comments, "http://")>0 then %>
    						<script language="javascript" type="text/javascript">
    							alert ("Links not allowed.");
    						</script>
    <%						task=""
    					else
    						br=chr(13) & chr(10)
    
    						msg=""
    						msg=msg & pname & br & "Phone: " & phone & br & "E-Mail Address: " & email & br & br & comments
    
    						set objTest=server.createobject("Persits.MailSender")
    						objTest.ContentTransferEncoding = "Quoted-Printable"
    						'objTest.AddAddress cStr("brian@mccauslandinc.com")
    						objTest.AddAddress cStr("brad@bbdesign.com")
    						objTest.FromName = cStr(pname)
    						objTest.From = cStr(email)
    						objTest.Subject = cStr("WEBSITE CONTACT FORM")
    						objTest.Body = cStr(msg)
    						objTest.SendToQueue
    						Set objTest = Nothing
    					end if
    				end if
    			end if
    
    	end select %>
    
    <form action="contact.asp" method="post">
    <input type="hidden" name="task" value="submit">
    
    <a href="http://www.mccauslandinc.com/"><img class="topphotos" src="art/mh_2a_contact.jpg" width="1024" height="239" border="0" /></a>
    
    <div class="content">
    	<h1>CONTACT</h1>
    
    <%	if task="submit" then %>
    
    	<p>Thank you, your message has been successfully sent. We will respond to your <nobr>request promptly.</nobr></p>
    
    <%	else %>
    
    	
    
    	<table border="0" cellspacing="0" cellpadding="0">
    		<tr valign="top" align="left">
    			<td class="alignright"><p class="nobr"><b>Name:</b></p></td>
    			<td><input type="text" name="pname" value="<% =pname %>" size="30"></td>
    		</tr>
    		<tr valign="top" align="left">
    			<td class="alignright"><p class="nobr"><b>Phone:</b></p></td>
    			<td><input type="text" name="phone" value="<% =phone %>" size="30"></td>
    		</tr>
    		<tr valign="top" align="left">
    			<td class="alignright"><p class="nobr"><b>E-Mail Address:</b></p></td>
    			<td><input type="text" name="email" value="<% =email %>" size="30"></td>
    		</tr>
    		<tr valign="top" align="left">
    			<td class="alignright"><p class="nobr"><b>Comments/Questions:</b></p></td>
    			<td><textarea name="comments" wrap="virtual" rows="8" cols="40"><% =comments %></textarea></td>
    		</tr>
    		<tr valign="top" align="left">
    			<td class="alignright"><p class="nobr"><b>&nbsp;</b></p></td>
    			<td><input type="submit" value="send message"></td>
    		</tr>
    	</table>
    
    	<div class="clear"></div>
    
    <%	end if %>
    </div>
    
    </form>
    
    <!-- #INCLUDE FILE="_foot.asp" -->

  2. #2
    SitePoint Enthusiast
    Join Date
    Jan 2012
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.aspemail.com/manual_05.html

    you will have to get the authentication username and password from the hosting company.

  3. #3
    SitePoint Addict itHighway's Avatar
    Join Date
    Jan 2008
    Location
    GUJ
    Posts
    270
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This means that the server needs to authenticate that the email is sent by the client/client-website.
    You may need to provide your website email address and password in the email script.

    Example:
    ObjTest.Username = "info@yourwebsitename.com"
    ObjTest.Password = "youremailpassword"


Bookmarks

Posting Permissions

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