Question : SMTP Mail

Ok below is my code that I have The GoToEmail is actually a step in the CreateUserWizard The error message is At the very Bottom I am sure you dont need the whole thing but I am including it just to be thorough

    Protected Sub GoToEmail_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles GoToEmail.Load

        'create the mail message
        Dim mail As New Net.Mail.MailMessage()

        'set the addresses
        mail.From = New Net.Mail.MailAddress("admin@shotdrive.com")
        mail.To.Add("scripter@tampabay.rr.com")

        'set the content
        mail.Subject = "This is an email"
        mail.Body = "this is the body content of the email."

        'send the message
        Dim smtp As New Net.Mail.SmtpClient("smtp.net")

        'to authenticate we set the username and password properites on the SmtpClient
        smtp.Credentials = New Net.NetworkCredential("username", "password")
        smtp.Send(mail)
        'Authenticate
    End Sub



The Error I recieved was

Server Error in '/WebSite2' Application.
--------------------------------------------------------------------------------

A from e-mail address must be specified in the From property or the system.net/mailSettings/smtp config section.
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.Web.HttpException: A from e-mail address must be specified in the From property or the system.net/mailSettings/smtp config section.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[HttpException (0x80004005): A from e-mail address must be specified in the From property or the system.net/mailSettings/smtp config section.]
   System.Web.UI.WebControls.MailDefinition.CreateMailMessage(String recipients, IDictionary replacements, String body, Control owner) +329
   System.Web.UI.WebControls.MailDefinition.CreateMailMessage(String recipients, IDictionary replacements, Control owner) +310
   System.Web.UI.WebControls.LoginUtil.CreateMailMessage(String email, String userName, String password, MailDefinition mailDefinition, String defaultBody, Control owner) +215
   System.Web.UI.WebControls.LoginUtil.SendPasswordMail(String email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +479
   System.Web.UI.WebControls.CreateUserWizard.AttemptCreateUser() +642
   System.Web.UI.WebControls.CreateUserWizard.OnNextButtonClick(WizardNavigationEventArgs e) +200
   System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +651
   System.Web.UI.WebControls.CreateUserWizard.OnBubbleEvent(Object source, EventArgs e) +158
   System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +39
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +107
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +178
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3838

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

Answer : SMTP Mail

I have also looked up the error on the EmbeddedMailObject.Path property. It is used to embed items in the email obviously. Did you put a MailDefinition in your aspx file in the tag? If you did then, the error is saying that it cannot find the item you are trying to embed.

It would look like this:

     
       
          ...
       

       
         
           
         

       

     
Random Solutions  
 
programming4us programming4us