Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 June 14th, 2012, 08:25 AM
Registered User
 
Join Date: Jun 2012
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default SMTP EMAIL NOT WORKING

Hi Imar,

I'm currently in the excercise how to send email from ur web page.
The Specifiedpickupdirectory is working fine bt sending from mail to mail not working as it says timeout expired.

As i've already searched the forums and couldn't able to get a solution. Another guy is also having the same problem as i in which he also needs solution. But he's having a different error. so please help me to get a solution.

Here's my code

Code:
Email.aspx.cs
-------------

protected void Page_Load(object sender, EventArgs e)
    {
        MailMessage myMessage = new MailMessage();
        myMessage.Subject = "Text Message";
        myMessage.Body = "Hello World, Welcome To Planet Wrox";
        myMessage.From = new MailAddress("[email protected]", "Developer");
        myMessage.To.Add(new MailAddress("[email protected]", "Developer"));

        SmtpClient mySmtpClient = new SmtpClient();
        mySmtpClient.Send(myMessage);
    }


Web.config
-----------

<?xml version="1.0"?>

<configuration>

  <system.web>
        <compilation debug="true" targetFramework="4.0" />
      <pages theme ="Monochrome">
        <controls>
          <add tagName="Banner" tagPrefix="Wrox" src ="~/Controls/Banner.ascx"/>
        </controls>
      </pages>
    </system.web>
  <system.net>
  <mailSettings>
    <!--<smtp deliveryMethod ="SpecifiedPickupDirectory">
      <specifiedPickupDirectory pickupDirectoryLocation ="c:\TempMail" />-->
    <smtp deliveryMethod="Network" from="[email protected]">
      <network enableSsl ="true" userName="myname" password="mypass" host="smtp.gmail.com" port="465"/>
    </smtp>
  </mailSettings>
  </system.net>
</configuration>
 
Old June 14th, 2012, 06:25 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Cross post..... SMTP EMAIL NOT WORKING

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
SMTP EMAIL NOT WORKING Rajasekar1988 BOOK: Beginning ASP.NET 4 : in C# and VB 7 June 15th, 2012 05:26 AM
SMTP Email problems vbboyd BOOK: Beginning ASP.NET 4 : in C# and VB 5 March 7th, 2012 08:49 AM
SMTP Email question snufse ASP.NET 2.0 Basics 2 July 9th, 2009 11:08 AM
SMTP Email Error Handling Ron Howerton Pro Visual Basic 2005 1 July 12th, 2007 08:32 AM
Sending EMail thru SMTP server in C# - Most of the peri C# 1 December 20th, 2004 09:33 PM





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