Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 13th, 2006, 05:18 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default sending email from a form

hello all,

i have started programming using asp.net, and have built a form with multiple input types on it, now i want to submit this form and once submitted, i want it to be send as mail, could anyone give a little example about it? i have searched a little about this topic and found that i have to use CDONTS,(it seems a component responsible for doing all the email stuff) but also i found warnings that to use CDOSYS, both of them i dont know nothing about,so could anyone help me?
thanks,
Best regards

 
Old February 13th, 2006, 10:46 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Look in the System.Web.Mail namespace. .NET has built in classes that should do all of what you need.

http://www.google.com/search?q=System.Web.Mail

-Peter
 
Old February 20th, 2006, 05:11 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default

thanks peter, i will check it and get back to you.

 
Old February 21st, 2006, 04:47 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default

Peter,

i know this might seems strange, but i am developping the asp.net webapp on my local machine, how should i know if the email was send successfully(no internet connection)?
if you didn't get me let me know, i will try to explain it better since i am new to this kind of stuff.
thanks for your understanding.

 
Old February 22nd, 2006, 01:37 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default

ok, i have connected my pc to internet, i have windows xp, and i am using the following code to send the email from the form(it s simple, but doesn't work)(note that this is a portion, without the decalrations for space, if you need the whole code tell me)
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
 <% Option Explicit %>
 <% 
'Get data from previous page
 sTo = Request("sTo") 
 sFrom = Request("sFrom") 
 sSubject = Request("sSubject")
 sTextBody = Request("sTextBody") 
 sHTMLBody = Request("sHTMLBody") 
 
'Only run this if it's not the first time 
 If Request.Form("Submit") <> "" Then
 
 Dim objMail 
 'Create the mail object 
 Set objMail = Server.CreateObject("CDO.Message")
 'Set key properties 
 objMail.From = sFrom 
 objMail.To = sTo 
 objMail.Subject= sSubject 
 objMail.TextBody = sTextBody 
 objMail.HTMLBody = sHTMLBody 
 
'Send the email 
 objMail.Send 
 'Set sMsg which will be used later 
 sMsg = "Your message was sent to: " & sTo 
 
 'Clean-up 
 Set objMail = Nothing
 
 End If 
%>
<html>
 <head><title>SendMail</title></head>
 <body>
  <form action="<%=Request.ServerVariables("PATH_INFO")%>" method="post">
  <table>
    <tr>
      <td>Send To:</td>
      <td><input type="text" name="sTo" value="<%=sTo%>"></td>
    </tr>
    <tr>
      <td>Send From:</td>
      <td><input type="text" name="sFrom" value="<%=sFrom%>"></td>
    </tr>
   <tr>
      <td>Message Subject:</td>
      <td><input type="text" name="sSubject" value="<%=sSubject%>"></td>
    </tr>
    <tr>
      <td>Message Text Body:</td>
      <td><textarea cols="60" rows="5" name="sTextBody">
         <%=sTextBody%></textarea></td>
    </tr>
    <tr>
      <td>Message HTML Body:</td>
      <td><textarea cols="60" rows="5" name="sHTMLBody">
         <%=sHTMLBody%></textarea></td>
    </tr>
    <tr>
      <td> </td>
      <td><input type="submit" name="Submit" value="Submit"></td>
    </tr>
  </table>

  <%=sMsg%>
  </form>
 </body>
 </html>

ok now when i submit, here is the error that i am getting:
CDO.Message.1 (0x80040220)
The "SendUsing" configuration value is invalid.
 what should i do? please i need help, any kind of help or suggestions( i googled a little, but i didn't understand anything of all this technical explanation about windows server... all i am using is windows xp with iis installed!!!)


 
Old February 22nd, 2006, 02:58 PM
Authorized User
 
Join Date: Nov 2005
Posts: 87
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to x_ray
Default

ok i googled a little and found the solution, thanks on your attention anyway hand :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending EMAIL charleshua BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 16 September 3rd, 2008 12:27 AM
ASP: Sending a HTML form to an email address cancer10 Classic ASP Databases 4 February 19th, 2007 05:25 PM
sending email based on form value stecol Classic ASP Professional 0 February 1st, 2007 10:21 AM
Retrievin form details and sending email yus_nash Beginning PHP 3 September 16th, 2004 04:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.