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. sending Emails problem

sending Emails problem

Scheduled Pinned Locked Moved ASP.NET
help
7 Posts 2 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.
  • N Offline
    N Offline
    NidhiKanu
    wrote on last edited by
    #1

    Hi, I am using gmail smtp for sending Emails and using this code : // For sending Mail done by Nidhi on19sep08 public bool SendMail1(DataTable dt, string path) { string ToMail1 = ""; string UserName = ""; bool status = false; int count = 0; try { if (dt.Rows.Count > 1) { for (int i = 1; i <= dt.Rows.Count - 1; i++) { if (count == 0) { if (dt.Rows[0]["email"].ToString() != "") { ToMail1 = dt.Rows[0]["email"].ToString(); UserName = dt.Rows[0]["username"].ToString(); count = 1; } } if (dt.Rows[i]["email"].ToString() != "") { ToMail1 = ToMail1 + "," + dt.Rows[i]["email"].ToString(); UserName = UserName + "," + dt.Rows[i]["username"].ToString(); } } } else { if (dt.Rows.Count > 0) { if (dt.Rows[0]["email"].ToString() != "") { ToMail1 = dt.Rows[0]["email"].ToString(); UserName = dt.Rows[0]["username"].ToString(); } } } if (dt.Rows.Count > 0) { bool mailSent = false; SendMail objClsSendmail = new SendMail(); DataTable dtsmtpserver = objClsSendmail.getMailSetting(); int Port = Convert.ToInt32(dtsmtpserver.Rows[0][2].ToString()); string host = dtsmtpserver.Rows[0][1].ToString(); string User = dtsmtpserver.Rows[0][3].ToString(); string Password = dtsmtpserver.Rows[0][4].ToString(); MailAddress from = new MailAddress(dtsmtpserver.Rows[0][10].ToString()); MailAddress to = new MailAddress(ToMail1); MailMessage msg = new MailMessage(from, to); SqlConnection myConnection = new SqlConnection(SqlConnectionString.GetConnectionString()); SqlDataAdapter ad = new SqlDataAdapter("SELECT email FROM at_user where IsAdmin=1", myConnection);

    J 1 Reply Last reply
    0
    • N NidhiKanu

      Hi, I am using gmail smtp for sending Emails and using this code : // For sending Mail done by Nidhi on19sep08 public bool SendMail1(DataTable dt, string path) { string ToMail1 = ""; string UserName = ""; bool status = false; int count = 0; try { if (dt.Rows.Count > 1) { for (int i = 1; i <= dt.Rows.Count - 1; i++) { if (count == 0) { if (dt.Rows[0]["email"].ToString() != "") { ToMail1 = dt.Rows[0]["email"].ToString(); UserName = dt.Rows[0]["username"].ToString(); count = 1; } } if (dt.Rows[i]["email"].ToString() != "") { ToMail1 = ToMail1 + "," + dt.Rows[i]["email"].ToString(); UserName = UserName + "," + dt.Rows[i]["username"].ToString(); } } } else { if (dt.Rows.Count > 0) { if (dt.Rows[0]["email"].ToString() != "") { ToMail1 = dt.Rows[0]["email"].ToString(); UserName = dt.Rows[0]["username"].ToString(); } } } if (dt.Rows.Count > 0) { bool mailSent = false; SendMail objClsSendmail = new SendMail(); DataTable dtsmtpserver = objClsSendmail.getMailSetting(); int Port = Convert.ToInt32(dtsmtpserver.Rows[0][2].ToString()); string host = dtsmtpserver.Rows[0][1].ToString(); string User = dtsmtpserver.Rows[0][3].ToString(); string Password = dtsmtpserver.Rows[0][4].ToString(); MailAddress from = new MailAddress(dtsmtpserver.Rows[0][10].ToString()); MailAddress to = new MailAddress(ToMail1); MailMessage msg = new MailMessage(from, to); SqlConnection myConnection = new SqlConnection(SqlConnectionString.GetConnectionString()); SqlDataAdapter ad = new SqlDataAdapter("SELECT email FROM at_user where IsAdmin=1", myConnection);

      J Offline
      J Offline
      Jas 007
      wrote on last edited by
      #2

      try with other smtp server except google

      N 1 Reply Last reply
      0
      • J Jas 007

        try with other smtp server except google

        N Offline
        N Offline
        NidhiKanu
        wrote on last edited by
        #3

        How to do that,i mean is there is any surety that using other smtp server we will not get authentication problem.

        J 1 Reply Last reply
        0
        • N NidhiKanu

          How to do that,i mean is there is any surety that using other smtp server we will not get authentication problem.

          J Offline
          J Offline
          Jas 007
          wrote on last edited by
          #4

          i think so but not sure u can try by defining another SMTP.u r software developer ??

          N 1 Reply Last reply
          0
          • J Jas 007

            i think so but not sure u can try by defining another SMTP.u r software developer ??

            N Offline
            N Offline
            NidhiKanu
            wrote on last edited by
            #5

            Yes i m s/w developer,we have our own smtp server but i am getting problem while using it ,perhaps there is some problem in network setting,or may be problem in my code,so i need code for sending mail except than gmail smtp way.

            J 1 Reply Last reply
            0
            • J Jas 007

              [Message Deleted]

              J Offline
              J Offline
              Jas 007
              wrote on last edited by
              #6

              i think it is ur networking problem . contact with ur network with this issue.

              1 Reply Last reply
              0
              • N NidhiKanu

                Yes i m s/w developer,we have our own smtp server but i am getting problem while using it ,perhaps there is some problem in network setting,or may be problem in my code,so i need code for sending mail except than gmail smtp way.

                J Offline
                J Offline
                Jas 007
                wrote on last edited by
                #7

                [Message Deleted]

                J 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