Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : 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 December 28th, 2016, 11:29 PM
Registered User
 
Join Date: Dec 2016
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 9 Sending E-mail Try it Out

Hello,

When I try to run the E-mail.aspx.cs, I run into this error:

The remote name could not be resolved: 'smtp.zanestate.edu'

Here is my Code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;

public partial class Demos_Email : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        MailMessage myMessage = new MailMessage();
        myMessage.Subject = "Test Message";
        myMessage.Body = "Hello world, from Chris' Mind";
        myMessage.From = new MailAddress("[email protected]", "Chris");
        myMessage.To.Add(new MailAddress("[email protected]", "John"));

        SmtpClient mySmtpClient = new SmtpClient();
        mySmtpClient.Send(myMessage);
    }
}
Code:
<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
  </appSettings>
  <system.web>
    <pages theme="Monochrome">
      <controls>
        <add tagPrefix="Wrox" tagName="Banner" src="~/Controls/Banner.ascx" />
      </controls>
    </pages>
    <compilation debug="true" targetFramework="4.5.1">
      <assemblies>
        <add assembly="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      </assemblies>
    </compilation>
    <httpRuntime targetFramework="4.5.1"/>
  </system.web>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="Christopher &lt;[email protected]&gt;">
        <network host="smtp.zanestate.edu" />
      </smtp>
    </mailSettings>
  </system.net>
</configuration>
Is this something I will be able to do through this lesson??

Thanks in Advance,
Se7en
 
Old December 29th, 2016, 03:44 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In order to send a real mail, you need a valid mail server. smtp.zanestate.edu apparently doesn't exist, or may only exist within a private network. So you'll need to find a valid server address; zanestate.edu may use mail.zanestate.edu instead or something else), or you can use a free account like Gmail or Yahoo.

As an alternative, you can save the files in a local folder as explained on page 323; then you can open the emails with a client like Outlook.

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!
 
Old December 29th, 2016, 11:04 AM
Registered User
 
Join Date: Dec 2016
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

http://tinypic.com/r/be64ar/9

http://tinypic.com/r/2gv4i69/9

Alright, now I'm getting this issue after the final Try it Out on Chapter 9.

It shows that the Message Sent when I first open the page, but when I input information, it gives me the error in the first picture.

What code would you like to see?

Here is my whole file for Chapter 9:

http://s000.tinyupload.com/?file_id=...78082150954253
 
Old January 6th, 2017, 04:13 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

It seems we're now discussing this here: Chapter 10 flickerFree Pages

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
Exception thrown Sending E-Mail Messsages Chapter 9 Onypips ASP.NET 4.5.1 General Discussion 1 April 19th, 2015 01:27 AM
Chapter 9 - Sending E-mail Messages demac3 BOOK: Beginning ASP.NET 4 : in C# and VB 4 November 4th, 2010 03:39 PM
Chapter 9. I can't figure how to configure my website for sending E-mail banditonehundred BOOK: Beginning ASP.NET 4 : in C# and VB 11 April 19th, 2010 07:21 PM
Question Re Sending mail in Chapter 3 _fluffy_ BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 5 January 9th, 2007 12:30 AM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM





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