Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. HotMail in ASP.net

HotMail in ASP.net

Scheduled Pinned Locked Moved C#
csharpasp-netlinqcomdesign
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    om_metab
    wrote on last edited by
    #1

    this code not sending email Why? please help me

    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Net.Mail;
    using System.Net;
    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;

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

                MailMessage Mail = new MailMessage();
                Mail.To.Add("AotherEmail@hotmail.com");
                Mail.From = new MailAddress("MyEmail@hotmail.com");
                Mail.Subject = "ASp.net";
                Mail.Body = " hi I want Help";
                SmtpClient smt = new SmtpClient("smtp.hotmail.com");
                 
    
                smt.Send(Mail);
                
                Response.Write("Email Was Send");
    
            }
            catch (Exception ex)
            {
                Response.Write(" Email Invalid"+ex.Message );
            
            }
        }
    }
    

    }

    C U R 3 Replies Last reply
    0
    • O om_metab

      this code not sending email Why? please help me

      using System;
      using System.Collections;
      using System.Configuration;
      using System.Data;
      using System.Linq;
      using System.Web;
      using System.Net.Mail;
      using System.Net;
      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;

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

                  MailMessage Mail = new MailMessage();
                  Mail.To.Add("AotherEmail@hotmail.com");
                  Mail.From = new MailAddress("MyEmail@hotmail.com");
                  Mail.Subject = "ASp.net";
                  Mail.Body = " hi I want Help";
                  SmtpClient smt = new SmtpClient("smtp.hotmail.com");
                   
      
                  smt.Send(Mail);
                  
                  Response.Write("Email Was Send");
      
              }
              catch (Exception ex)
              {
                  Response.Write(" Email Invalid"+ex.Message );
              
              }
          }
      }
      

      }

      C Offline
      C Offline
      crocks256
      wrote on last edited by
      #2

      I dont know. Why dont you 1) Try and debug the code yourself 2) Check the Host name and credentials are correct 3) Post error messages :confused:

      1 Reply Last reply
      0
      • O om_metab

        this code not sending email Why? please help me

        using System;
        using System.Collections;
        using System.Configuration;
        using System.Data;
        using System.Linq;
        using System.Web;
        using System.Net.Mail;
        using System.Net;
        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;

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

                    MailMessage Mail = new MailMessage();
                    Mail.To.Add("AotherEmail@hotmail.com");
                    Mail.From = new MailAddress("MyEmail@hotmail.com");
                    Mail.Subject = "ASp.net";
                    Mail.Body = " hi I want Help";
                    SmtpClient smt = new SmtpClient("smtp.hotmail.com");
                     
        
                    smt.Send(Mail);
                    
                    Response.Write("Email Was Send");
        
                }
                catch (Exception ex)
                {
                    Response.Write(" Email Invalid"+ex.Message );
                
                }
            }
        }
        

        }

        U Offline
        U Offline
        uspatel
        wrote on last edited by
        #3

        Use network cardentials

        NetworkCredential authinfo = new NetworkCredential("id", "password");
        smtp.UseDefaultCredentials = false;
        smtp.Credentials = authinfo;

        1 Reply Last reply
        0
        • O om_metab

          this code not sending email Why? please help me

          using System;
          using System.Collections;
          using System.Configuration;
          using System.Data;
          using System.Linq;
          using System.Web;
          using System.Net.Mail;
          using System.Net;
          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;

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

                      MailMessage Mail = new MailMessage();
                      Mail.To.Add("AotherEmail@hotmail.com");
                      Mail.From = new MailAddress("MyEmail@hotmail.com");
                      Mail.Subject = "ASp.net";
                      Mail.Body = " hi I want Help";
                      SmtpClient smt = new SmtpClient("smtp.hotmail.com");
                       
          
                      smt.Send(Mail);
                      
                      Response.Write("Email Was Send");
          
                  }
                  catch (Exception ex)
                  {
                      Response.Write(" Email Invalid"+ex.Message );
                  
                  }
              }
          }
          

          }

          R Offline
          R Offline
          RichardGrimmer
          wrote on last edited by
          #4

          Unless they've changed it Hotmail doens't allow relaying, so you can't use it to send emails. You'll need a server that does permit relays.... IIRC, none of the big web-mail providers allow it for obvious reasons

          C# has already designed away most of the tedium of C++.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups