Sending Email Problem

Discussion in 'C#' started by mikee.jk, Mar 7, 2008.

  1. #1
    hi guys,

    can anyone resolve this problem of creating a contact page using asp....

    <html>
    <body>
    <form action="realmail.asp" method="post" id="form1" name="form1">
    
    	<table width="300px" height="auto" border="0">
    	
    		<tr>
    		<td>Name</td>
    		<td><input type="text" id="name" name="name"></td>
    		</tr>
    		
    		
    		<tr>
    		<td>Age</td>
    		<td><input type="text" id="age" name="age"></td>
    		</tr>
    		
    		
    		<tr>
    		<td>Sex</td>
    		<td><input type="text" id="sex" name="sex"></td>
    		</tr>
    		
    		<tr>
    		<td>Address</td>
    		<td><textarea id="msg" name="msg"></textarea></td>
    		</tr>
    		
    		
    		
    		<tr>
    		<td>Telephone</td>
    		<td><input type="text" id="tele" name="tele"></td>
    		</tr>
    		
    		
    		
    		<tr>
    		<td>Email</td>
    		<td><input type="text" id="email" name="email"></td>
    		</tr>
    		
    		
    		<tr>
    		<td>&nbsp;</td>
    		<td>
    		<input type="submit" name="Submit" value="Submit">
    		</td>
    		</tr>
    
    		
    		
    	</table>
    
    </form>
    </body>
    </html>
    Code (markup):


    <html>
     
    <body  text="#000066" bgcolor="#FFFFFF" >
    <%
    dim name
    dim age
    dim sex
    dim msg
    dim tele
    dim email
    
    name=trim(request.form("name"))
    age=trim(request.form("age"))
    sex=trim(request.form("sex"))
    msg=trim(request.form("msg"))
    tele=trim(request.form("tele"))
    email=trim(request.form("email"))
    
    
    
     message= " <div align='center'><center><table border='1' width='80%'> "
     message=message + "<tr><td width='30%' align='left'>Name :</td>"
     message=message + "<td width='50%' align='center'><p align='left'>"&name&"</td></tr>"
     message=message + "<tr><td width='30%' align='left'>Age :</td>"
     message=message + "<td width='50%' align='center'><p align='left'>"&age&"</td></tr>"
     message=message + "<tr><td width='30%' align='left'>Age :</td>"
     message=message + "<td width='50%' align='center'><p align='left'>"&sex&"</td></tr>" 
    	 message=message + "<tr><td width='30%' align='left'>Age :</td>"
         message=message + "<td width='50%' align='center'><p align='left'>"&msg&"</td></tr>"
     message=message + "<tr><td width='30%' align='left'>Age :</td>"
         message=message + "<td width='50%' align='center'><p align='left'>"&tele&"</td></tr>" 
    	 message=message + "<tr><td width='30%' align='left'>Age :</td>"
         message=message + "<td width='50%' align='center'><p align='left'>"&email&"</td></tr>"
     message=message + "</table></center></div>"
     
     dim objMail
     
     Set objMail = Server.CreateObject("Persits.MailSender")			
    		If sFormat = "text" Then
    		objMail.Ishtml = False
    		Else
    		objMail.Ishtml = True
    		End If
    		If sImportance = "high" Then
    		objMail.Priority = 1
    		ElseIf sImportance = "low" Then
    		objMail.Priority = 5
    		Else
    		objMail.Priority = 3
    		End If
    		
    		
    		objMail.Host = sMailServer
    		objMail.From = email
    		objMail.FromName = email
    		objMail.AddAddress "xx@xxx.com"
    		objMail.Subject = "Contact Request From Our Site"
    		objMail.Body =  message
    		objMail.Send
    		
    		
    		
    	   response.write "<center><b text='#000066'>We have received your Request  !!!<b><center><br>"
       	   response.write "<center><b text='#000066'>We will contact you soon !!!<b><center><br>"
    	   response.write "<center><b text='#000066'>Thank You !!!<b><center><br>"
    	   
    %>
    </body>
    </html>
    Code (markup):
     
    mikee.jk, Mar 7, 2008 IP
  2. Freelancer4u

    Freelancer4u Banned

    Messages:
    57
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Why are you looking for a ASP contact form,where you can get an awesome AJAX Contact form for just 5$.
    OM me now,if you need it..
     
    Freelancer4u, Mar 7, 2008 IP
  3. leen3o

    leen3o Peon

    Messages:
    89
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Can you use ASP.NET on your server? Much easier to send forms in
     
    leen3o, Mar 8, 2008 IP
  4. Free Born John

    Free Born John Guest

    Messages:
    111
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    objmail.from should be a valid mailaddress on your web server, otherwise you're relaying.
     
    Free Born John, Mar 10, 2008 IP