Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 13th, 2006, 05:18 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
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

  #2 (permalink)  
Old February 13th, 2006, 10:46 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
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
  #3 (permalink)  
Old February 20th, 2006, 05:11 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
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.

  #4 (permalink)  
Old February 21st, 2006, 04:47 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
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.

  #5 (permalink)  
Old February 22nd, 2006, 01:37 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
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!!!)


  #6 (permalink)  
Old February 22nd, 2006, 02:58 PM
Authorized User
 
Join Date: Nov 2005
Location: , , .
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 :)

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:50 PM.


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