Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design 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 August 4th, 2007, 12:20 AM
Authorized User
 
Join Date: Jul 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am EXTREMELY SORRY!. Please ignore the above code. I am posting the correct one once again.
_________________________
<%@ Page Language="VB" %>
<% @Import Namespace="System.Web.Mail" %>

<script runat="server">
Sub btnSend_Click(sender as Object, e as EventArgs)


  Dim maiLobj as New MailMessage()

  maiLobj.To = "1.dipanjan@gmail.com"
  maiLobj.From = "dipanjan@yahoo.co.in"


   maiLobj.Subject = "Test mail"
  maiLobj.Body = "Test mail. Please ignore"

  maiLobj.Priority = MailPriority.Normal
  maiLobj.BodyFormat = MailFormat.Text





   SmtpMail.SmtpServer = "127.0.0.1"

  'Now, to send the message, use the Send method of the SmtpMail class
  SmtpMail.Send(objMM)
msgbox("Mail Sent")
End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Sending mail by ASP.NET</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

     <asp:button runat="server" id="btnSend" Text="Send Mail!"
       OnClick="btnSend_Click" />

    </div>
    </form>
</body>
</html>


 
Old August 4th, 2007, 09:26 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I have encountered this problem with the IIS SMTP server. I would see the mail queued up but if never goes out. I have given up using the standard built in SMTP server.

Have you looked up your ISPs SMTP server address and tried that? This may be your best bet.

-Peter
 
Old August 4th, 2007, 08:03 PM
Authorized User
 
Join Date: Jul 2007
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah Thanks! So that means my code is logically correct. Also I read somewhere that some ISP blocks the deafult IIS SMTP port 25 to stop spams. Actually I only know my ISP smtp server but is not awared of it's port. Can I use gmail smtp server? Gmail gives you the opportunity to configure your mail handling programs.

 
Old August 5th, 2007, 09:16 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You can set your code up to use any SMTP server really, it is just a matter of configuring your code to do so.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual Web Developer 2005 dipanjan22 ASP.NET 1.x and 2.0 Application Design 2 July 12th, 2007 12:22 AM
SQL Server 2005 using Visual Web Developer carswelljr SQL Server 2005 1 September 14th, 2006 12:43 PM
visual web developer 2005 carswelljr VB How-To 2 September 13th, 2006 03:40 PM
Microsoft Visual Web Developer 2005 Express Editio FT BOOK: ASP.NET Website Programming Problem-Design-Solution 10 April 24th, 2006 12:25 AM
SQL Server 2005 Express with Visual Web Developer steffteo SQL Server 2005 1 March 19th, 2006 04:28 PM





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