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. Web Development
  3. ASP.NET
  4. SEND MAIL

SEND MAIL

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netsysadminhelp
6 Posts 5 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.
  • L Offline
    L Offline
    laxman sindh
    wrote on last edited by
    #1

    Hello, plz help me i want to send email from asp.net web application in our godaddy server. .......................

    L S W D 5 Replies Last reply
    0
    • L laxman sindh

      Hello, plz help me i want to send email from asp.net web application in our godaddy server. .......................

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Some samples[^].

      speaking as ...

      1 Reply Last reply
      0
      • L laxman sindh

        Hello, plz help me i want to send email from asp.net web application in our godaddy server. .......................

        S Offline
        S Offline
        Sandeep Mewara
        wrote on last edited by
        #3

        For GoDaddy, you need to use: servername: relay-hosting.secureserver.net port: 25 Thus, email code should be something like:

        MailMessage msg = new MailMessage();
        msg.From = new MailAddress("myEmail@abc.com","My Company");
        msg.To.Add("toFriends@abc.com");
        msg.Subject = "My Subject";
        msg.Body = "My Message";
        msg.IsBodyHtml = true;

        // MailMessage instance to a specified SMTP server
        SmtpClient smtp = new SmtpClient("relay-hosting.secureserver.net", 25);

        // Send the email
        smtp.Send(msg);

        Sandeep Mewara [My last article]: Server side Delimiters in ASP.NET[^]

        1 Reply Last reply
        0
        • L laxman sindh

          Hello, plz help me i want to send email from asp.net web application in our godaddy server. .......................

          S Offline
          S Offline
          Sandeep Mewara
          wrote on last edited by
          #4

          For GoDaddy, you need to use: servername: relay-hosting.secureserver.net port: 25 Thus, email code should be something like:

          MailMessage msg = new MailMessage();
          msg.From = new MailAddress("myEmail@abc.com","My Company");
          msg.To.Add("toFriends@abc.com");
          msg.Subject = "My Subject";
          msg.Body = "My Message";
          msg.IsBodyHtml = true;

          // MailMessage instance to a specified SMTP server
          SmtpClient smtp = new SmtpClient("relay-hosting.secureserver.net", 25);

          // Send the email
          smtp.Send(msg);

          Try!

          Sandeep Mewara [My last article]: Server side Delimiters in ASP.NET[^]

          1 Reply Last reply
          0
          • L laxman sindh

            Hello, plz help me i want to send email from asp.net web application in our godaddy server. .......................

            W Offline
            W Offline
            wikizhao
            wrote on last edited by
            #5

            this code have some chinese,if you know #region :Send Email /// /// Send Email(Success return true, faile retuan false) /// /// content /// theme /// send email /// send keys/param> /// get email /// Success return true, faile retuan false public static bool SendMail(string strBody, string strSubject, string strFrom, string strFromPwd, string strTo, string strSmtp) { bool b = false; // 邮件信息(属性) MailMessage mm = new MailMessage(); mm.From = new MailAddress(strFrom); mm.Subject = strSubject; mm.SubjectEncoding = Encoding.UTF8; mm.Body = strBody; mm.BodyEncoding = Encoding.UTF8; mm.IsBodyHtml = true; mm.Priority = MailPriority.Normal; //// 获取 SMTP 服务器 //string Smtp = string.Empty; // smtp 地址 //// 取得后部分的 smtp地址 //string strSmtp = strFrom.Substring((strFrom.IndexOf("@") + 1)); //Smtp = "smtp." + strSmtp; // 发送邮件 SmtpClient sc = new SmtpClient(strSmtp); // 用户凭证 (email 地址和密码) sc.Credentials = new NetworkCredential(strFrom, strFromPwd); if (strSmtp == "gmail.com") { sc.EnableSsl = true; } sc.Timeout = 5000; mm.To.Clear(); mm.To.Add(strTo); try { sc.Send(mm); b = true; } catch (ArgumentNullException ex) { b = false; } catch (SmtpException smtpEx) { b = false; } catch { b = false; } // 释放资源 mm.Dispose(); return b; } #endregion

            1 Reply Last reply
            0
            • L laxman sindh

              Hello, plz help me i want to send email from asp.net web application in our godaddy server. .......................

              D Offline
              D Offline
              Dhyanga
              wrote on last edited by
              #6

              Try this..I hope this what you want..Let us know if this doesn't solve your problem..

              string strNoReplyEmail = "noreply@hotmail.com";

              private void SendEMail(string strLastName, string strFirstName, string strEmail)
              {

              MailMessage objMail = new MailMessage(strNoReplyEmail, strEmail);
              objMail.Subject = "Test Email";
              objMail.Body = @"Dear " + strFirstName + " " + strLastName + ", \\n\\n"
                  + "This is the test email. Please do not reply to this email."
                  + " \\n\\n"
                  + "Thank you,"
                  + "\\n"
                  + "Administrator";              
              
              SmtpClient sc = new SmtpClient();
              sc.Host = "www.hotmail.com";
              sc.Send(objMail);
              

              }

              Dhyanga

              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