Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 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 September 18th, 2010, 06:36 PM
Authorized User
 
Join Date: Oct 2009
Posts: 40
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Thanks for replying.

Well ive dug out some of my old posts and found your link on how to create a local drop folder instead.

My system system.net in my web.config now looks like this:
[code]
system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickUpDirectory" from="Lee Bell &lt;leemark2k3@hotmail.com&gt;" >
<specifiedPickupDirectory pickupDirectoryLocation="C:\TempMail"/>
</smtp>
</mailSettings>

[code] My username and password were underlined so i removed them as i thought they were no longer necessary. Initially it came up with an error telling me that i cant have enable ssl set to true. I removed it and also tried enable ssl to false but still get the following error:

Could not find a part of the path 'C:\TempMail\bc5375f7-456d-487e-9c73-6289563bef98.eml'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\TempMail\bc5375f7-456d-487e-9c73-6289563bef98.eml'.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

<%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:


[DirectoryNotFoundException: Could not find a part of the path 'C:\TempMail\bc5375f7-456d-487e-9c73-6289563bef98.eml'.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +193
System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +1162
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) +61
System.IO.FileStream..ctor(String path, FileMode mode) +55
System.Net.Mail.SmtpClient.GetFileMailWriter(Strin g pickupDirectory) +218
System.Net.Mail.SmtpClient.Send(MailMessage message) +978

[SmtpException: Failure sending mail.]
System.Net.Mail.SmtpClient.Send(MailMessage message) +1531
Sign_up.CreateUserWizard1_SendingMail(Object sender, MailMessageEventArgs e) +36
System.Web.UI.WebControls.CreateUserWizard.OnSendi ngMail(MailMessageEventArgs e) +108
System.Web.UI.WebControls.LoginUtil.SendPasswordMa il(String email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +367
System.Web.UI.WebControls.CreateUserWizard.Attempt CreateUser() +547
System.Web.UI.WebControls.CreateUserWizard.OnNextB uttonClick(WizardNavigationEventArgs e) +102
System.Web.UI.WebControls.Wizard.OnBubbleEvent(Obj ect source, EventArgs e) +418
System.Web.UI.WebControls.CreateUserWizard.OnBubbl eEvent(Object source, EventArgs e) +161
System.Web.UI.WebControls.WizardChildTable.OnBubbl eEvent(Object source, EventArgs args) +19
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +166
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint



Here is my code for the signup class:
Code:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Net.Mail;

public partial class Sign_up : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
   
    protected void CreateUserWizard1_SendingMail(object sender, MailMessageEventArgs e)
    {
        SmtpClient mySmtpClient = new SmtpClient();
        mySmtpClient.Send(e.Message);
        e.Cancel = true;

        
    }
   
}
Code:
<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="Sign-up.aspx.cs" Inherits="Sign_up" Title="Sign-Up" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" 

    onsendingmail="CreateUserWizard1_SendingMail">
        <MailDefinition BodyFileName="~/App_Data/Sign-UpConfirmation.txt" 
            Subject="Your new account at Salford Student Books">
        </MailDefinition>
        <WizardSteps>
            <asp:CreateUserWizardStep runat="server" />
            <asp:CompleteWizardStep runat="server" />
        </WizardSteps>
    </asp:CreateUserWizard>
</asp:Content>
With local drop folders, will it still go through my hotmail(so i receive an email in my inbox as well as being distributed to c:\TempMail on my computer).

Many thanks.
 
Old September 19th, 2010, 06:54 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
With local drop folders, will it still go through my hotmail(so i receive an email in my inbox as well as being distributed to c:\TempMail on my computer).
No. The whole idea of the local drop folder is that it, well, drops your mail locally.

Quote:
Could not find a part of the path 'C:\TempMail\bc5375f7-456d-487e-9c73-6289563bef98.eml'.
As I hinted in my e-mail some time ago, you need to create the TempMail folder first.

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 4th, 2010, 01:02 PM
Authorized User
 
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
Default

Hi firstly, I must compliment you on an excellent book

I also have a problem with e-mail. In the Try it out on page 309 I get the following screen

http://i156.photobucket.com/albums/t...02/email-1.jpg

Code is as follows
Code:
<system.net>
    <mailSettings>
      <smtp deliveryMethod="Network" from="My Name &lt;myname@.yahoo.co.uk;">
        <network host="smtp.mail.yahoo.com"/>
      </smtp>
    </mailSettings>
  </system.net>

Code:
<%@ Page Language="VB" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="false" CodeFile="Email.aspx.vb" Inherits="Email" Title="E-mail Demo" Debug ="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
</asp:Content>
Code:
Imports System.Net.Mail
Partial Class Email
    Inherits BasePage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim myMessage As MailMessage = New MailMessage()
        myMessage.Subject = "Test Message"
        myMessage.Body = "Hello world, from Planet Wrox"
        myMessage.From = New MailAddress("myname@yahoo.co.uk", "Sender Name Here")
        myMessage.To.Add(New MailAddress("myname@yahoo.co.uk", "Receiver Name Here"))

        Dim mySmtpClient As SmtpClient = New SmtpClient()
        mySmtpClient.Send(myMessage)
    End Sub
End Class
 
Old December 4th, 2010, 01:54 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Take a look here: http://imar.spaanjaars.com/499/how-t...e-mail-address

And then look at the address in your web.config file. It has only the left side of the brackets (&lt;), has an additional . following the @ and ends with an invalid semi-colon.

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!
The Following User Says Thank You to Imar For This Useful Post:
GeeTee991100 (December 10th, 2010)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9 Trying to send email out digink BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 6 March 5th, 2011 05:42 AM
Chapter 9 Can't send email ChuckASP BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 April 22nd, 2010 12:16 PM
Chapter 9 - email security ChuckASP BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 2 March 20th, 2010 03:26 PM
Chapter 3 - Email List daibhidh BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 6 December 4th, 2009 06:39 AM
Chapter 11 - Email HELP! Nyika1203 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 July 28th, 2008 06:45 PM





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