Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 26th, 2008, 12:44 AM
Registered User
 
Join Date: Aug 2008
Location: , CA, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP VB.Net send email

Hey There,

I am having trouble wrapping my head arround sending emails in asp .net (VB).

I have updated my web.config with smtp settings, however when I do a page load event to create a new mailmessage class i get an error that MailMessage()is not defined.

Below is my web.config except and my page load event.

Thanks for your help on this, and I really hope someone can help.

-Rick

~~~Page Load~~~
Partial Class _500
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim msg As New MailMessage()

    End Sub
End Class

~~~Web Config ~~~
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network">
        <network
            defaultCredentials="false"
             host="my.mail.server.com"
             port="25"
             userName="XXXX"
             password="XXXX" />
      </smtp>
    </mailSettings>
  </system.net>

(I replace the host / username / password with valid details.)

Reply With Quote
  #2 (permalink)  
Old August 26th, 2008, 04:13 AM
Authorized User
Points: 198, Level: 3
Points: 198, Level: 3 Points: 198, Level: 3 Points: 198, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: singapore, singapore, Singapore.
Posts: 54
Thanks: 0
Thanked 4 Times in 4 Posts
Default

hi

i think you have to use System.Net.Mail.MailMessage while defining or else import System.Net.Mail and use MailMessage

Pon Saravanan
http://www.vbknowledgebase.com
Reply With Quote
  #3 (permalink)  
Old August 26th, 2008, 12:08 PM
Registered User
 
Join Date: Aug 2008
Location: , CA, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ahhh, thanks

Is there a way todo this in the web.config file?

Reply With Quote
  #4 (permalink)  
Old August 26th, 2008, 07:59 PM
Authorized User
Points: 198, Level: 3
Points: 198, Level: 3 Points: 198, Level: 3 Points: 198, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: singapore, singapore, Singapore.
Posts: 54
Thanks: 0
Thanked 4 Times in 4 Posts
Default

you can do it in pagelevel as follows, put the following line in top of the page.

imports System.Net.Mail

In web.config level
in web.config
<system.web>

    <pages>
        <imports>
            <add namespace="MyWeb.UI" />
        </imports>
    </pages>

</system.web>






Pon Saravanan
http://www.vbknowledgebase.com/WebAp...ridView-Paging
Reply With Quote
Reply


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
send email by asp phuc2583 Classic ASP Basics 6 December 17th, 2007 10:52 PM
read/send email using WEBDEV and vb.net prashanthudupa.k Excel VBA 0 September 21st, 2006 06:39 AM
send MASS Emails in ASP.NET 2 with VB.NET 2005 alexdcosta ASP.NET 2.0 Basics 1 July 17th, 2006 12:31 AM
Smtp blocked, how can I send email use asp.net calvinpost ASP.NET 1.x and 2.0 Application Design 7 April 1st, 2004 09:41 AM



All times are GMT -4. The time now is 10:48 PM.


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