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. Email Sending

Email Sending

Scheduled Pinned Locked Moved C#
csharpcomcareer
6 Posts 6 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.
  • S Offline
    S Offline
    Shrimants Satpute
    wrote on last edited by
    #1
            MailMessage mail = new MailMessage();
            try
            {
                SmtpClient smtp = new SmtpClient();
    
    
                System.Net.NetworkCredential nc = new System.Net.NetworkCredential("\[DELETED\]@gmail.com", "\[DELETED\]");
                smtp.Port = 587;
                smtp.Host = "smtp.gmail.com";
                smtp.EnableSsl = true;
                smtp.UseDefaultCredentials = false;
                smtp.Credentials = nc;
    
                mail.To.Add("shreeraje2345@gmail.com");
                mail.From = new MailAddress(txtEmail.Text);
                mail.Subject = txtName.Text;
    
                string body = "From: " + txtName.Text + "\\n";
                body += "Email: " + txtEmail.Text + "\\n";
                body += "Applied For Job ID: " + lblJobId.Text + "\\n";
                body += "Applied For Job Position: " + lblJobName.Text + "\\n";
                body += "DOB:" + txtDOB.Text + "\\n";
                body += "Qualification:" + dllQualifn.SelectedItem.Text + "\\n";
                body += "Specialization:" + dllSpcialn.SelectedItem.Text + "\\n";
                body += "Address:" + txtAddress.Text + "\\n";
                body += "Pincode:" + txtPincode.Text + "\\n";
                body += "State:" + txtState.Text + "\\n";
                body += "City:" + txtCity.Text + "\\n";
                body += "Wheather Experience:" + dllW\_Exp.SelectedItem.Text + "\\n";
                body += "Years Of Experience:" + txtY\_Exp.Text + "\\n";
                body += "Verification Code:" + txtCaptcha.Text + "\\n";
                mail.Body = body;
                mail.Attachments.Add(new Attachment(PhotoUpload.FileContent, System.IO.Path.GetFileName(PhotoUpload.FileName)));
                mail.Attachments.Add(new Attachment(ResumeUpload.FileContent, System.IO.Path.GetFileName(ResumeUpload.FileName)));
    
    
    
                smtp.Send(mail);
                lblMessage.Text = "Your Application has been send sucessfully";
    

    work on local host but not work when i use on godadday host [edit]Email details removed, Code block added - OriginalGriff[/edit]

    M OriginalGriffO B F A 5 Replies Last reply
    0
    • S Shrimants Satpute
              MailMessage mail = new MailMessage();
              try
              {
                  SmtpClient smtp = new SmtpClient();
      
      
                  System.Net.NetworkCredential nc = new System.Net.NetworkCredential("\[DELETED\]@gmail.com", "\[DELETED\]");
                  smtp.Port = 587;
                  smtp.Host = "smtp.gmail.com";
                  smtp.EnableSsl = true;
                  smtp.UseDefaultCredentials = false;
                  smtp.Credentials = nc;
      
                  mail.To.Add("shreeraje2345@gmail.com");
                  mail.From = new MailAddress(txtEmail.Text);
                  mail.Subject = txtName.Text;
      
                  string body = "From: " + txtName.Text + "\\n";
                  body += "Email: " + txtEmail.Text + "\\n";
                  body += "Applied For Job ID: " + lblJobId.Text + "\\n";
                  body += "Applied For Job Position: " + lblJobName.Text + "\\n";
                  body += "DOB:" + txtDOB.Text + "\\n";
                  body += "Qualification:" + dllQualifn.SelectedItem.Text + "\\n";
                  body += "Specialization:" + dllSpcialn.SelectedItem.Text + "\\n";
                  body += "Address:" + txtAddress.Text + "\\n";
                  body += "Pincode:" + txtPincode.Text + "\\n";
                  body += "State:" + txtState.Text + "\\n";
                  body += "City:" + txtCity.Text + "\\n";
                  body += "Wheather Experience:" + dllW\_Exp.SelectedItem.Text + "\\n";
                  body += "Years Of Experience:" + txtY\_Exp.Text + "\\n";
                  body += "Verification Code:" + txtCaptcha.Text + "\\n";
                  mail.Body = body;
                  mail.Attachments.Add(new Attachment(PhotoUpload.FileContent, System.IO.Path.GetFileName(PhotoUpload.FileName)));
                  mail.Attachments.Add(new Attachment(ResumeUpload.FileContent, System.IO.Path.GetFileName(ResumeUpload.FileName)));
      
      
      
                  smtp.Send(mail);
                  lblMessage.Text = "Your Application has been send sucessfully";
      

      work on local host but not work when i use on godadday host [edit]Email details removed, Code block added - OriginalGriff[/edit]

      M Offline
      M Offline
      Michael_Davies
      wrote on last edited by
      #2

      You have left your email address and the password visible in your code!

      1 Reply Last reply
      0
      • S Shrimants Satpute
                MailMessage mail = new MailMessage();
                try
                {
                    SmtpClient smtp = new SmtpClient();
        
        
                    System.Net.NetworkCredential nc = new System.Net.NetworkCredential("\[DELETED\]@gmail.com", "\[DELETED\]");
                    smtp.Port = 587;
                    smtp.Host = "smtp.gmail.com";
                    smtp.EnableSsl = true;
                    smtp.UseDefaultCredentials = false;
                    smtp.Credentials = nc;
        
                    mail.To.Add("shreeraje2345@gmail.com");
                    mail.From = new MailAddress(txtEmail.Text);
                    mail.Subject = txtName.Text;
        
                    string body = "From: " + txtName.Text + "\\n";
                    body += "Email: " + txtEmail.Text + "\\n";
                    body += "Applied For Job ID: " + lblJobId.Text + "\\n";
                    body += "Applied For Job Position: " + lblJobName.Text + "\\n";
                    body += "DOB:" + txtDOB.Text + "\\n";
                    body += "Qualification:" + dllQualifn.SelectedItem.Text + "\\n";
                    body += "Specialization:" + dllSpcialn.SelectedItem.Text + "\\n";
                    body += "Address:" + txtAddress.Text + "\\n";
                    body += "Pincode:" + txtPincode.Text + "\\n";
                    body += "State:" + txtState.Text + "\\n";
                    body += "City:" + txtCity.Text + "\\n";
                    body += "Wheather Experience:" + dllW\_Exp.SelectedItem.Text + "\\n";
                    body += "Years Of Experience:" + txtY\_Exp.Text + "\\n";
                    body += "Verification Code:" + txtCaptcha.Text + "\\n";
                    mail.Body = body;
                    mail.Attachments.Add(new Attachment(PhotoUpload.FileContent, System.IO.Path.GetFileName(PhotoUpload.FileName)));
                    mail.Attachments.Add(new Attachment(ResumeUpload.FileContent, System.IO.Path.GetFileName(ResumeUpload.FileName)));
        
        
        
                    smtp.Send(mail);
                    lblMessage.Text = "Your Application has been send sucessfully";
        

        work on local host but not work when i use on godadday host [edit]Email details removed, Code block added - OriginalGriff[/edit]

        OriginalGriffO Offline
        OriginalGriffO Offline
        OriginalGriff
        wrote on last edited by
        #3

        Never post your email address in any forum, unless you really like spam! And posting it with your password as well? Frankly, that's just plain stupid! :sigh:

        Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

        "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
        "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

        1 Reply Last reply
        0
        • S Shrimants Satpute
                  MailMessage mail = new MailMessage();
                  try
                  {
                      SmtpClient smtp = new SmtpClient();
          
          
                      System.Net.NetworkCredential nc = new System.Net.NetworkCredential("\[DELETED\]@gmail.com", "\[DELETED\]");
                      smtp.Port = 587;
                      smtp.Host = "smtp.gmail.com";
                      smtp.EnableSsl = true;
                      smtp.UseDefaultCredentials = false;
                      smtp.Credentials = nc;
          
                      mail.To.Add("shreeraje2345@gmail.com");
                      mail.From = new MailAddress(txtEmail.Text);
                      mail.Subject = txtName.Text;
          
                      string body = "From: " + txtName.Text + "\\n";
                      body += "Email: " + txtEmail.Text + "\\n";
                      body += "Applied For Job ID: " + lblJobId.Text + "\\n";
                      body += "Applied For Job Position: " + lblJobName.Text + "\\n";
                      body += "DOB:" + txtDOB.Text + "\\n";
                      body += "Qualification:" + dllQualifn.SelectedItem.Text + "\\n";
                      body += "Specialization:" + dllSpcialn.SelectedItem.Text + "\\n";
                      body += "Address:" + txtAddress.Text + "\\n";
                      body += "Pincode:" + txtPincode.Text + "\\n";
                      body += "State:" + txtState.Text + "\\n";
                      body += "City:" + txtCity.Text + "\\n";
                      body += "Wheather Experience:" + dllW\_Exp.SelectedItem.Text + "\\n";
                      body += "Years Of Experience:" + txtY\_Exp.Text + "\\n";
                      body += "Verification Code:" + txtCaptcha.Text + "\\n";
                      mail.Body = body;
                      mail.Attachments.Add(new Attachment(PhotoUpload.FileContent, System.IO.Path.GetFileName(PhotoUpload.FileName)));
                      mail.Attachments.Add(new Attachment(ResumeUpload.FileContent, System.IO.Path.GetFileName(ResumeUpload.FileName)));
          
          
          
                      smtp.Send(mail);
                      lblMessage.Text = "Your Application has been send sucessfully";
          

          work on local host but not work when i use on godadday host [edit]Email details removed, Code block added - OriginalGriff[/edit]

          B Offline
          B Offline
          Bilgehan Berberoglu
          wrote on last edited by
          #4

          Hi, GoDaddy blocks the SSL ports required by gmail's smtp access. That means you should use godaddy account :sigh: For more detail, check 1- https://www.godaddy.com/help/using-cdosys-to-send-email-from-your-windows-hosting-account-1073[^] 2- https://www.godaddy.com/help/what-do-i-do-if-i-have-trouble-connecting-to-my-email-account-319[^]

          1 Reply Last reply
          0
          • S Shrimants Satpute
                    MailMessage mail = new MailMessage();
                    try
                    {
                        SmtpClient smtp = new SmtpClient();
            
            
                        System.Net.NetworkCredential nc = new System.Net.NetworkCredential("\[DELETED\]@gmail.com", "\[DELETED\]");
                        smtp.Port = 587;
                        smtp.Host = "smtp.gmail.com";
                        smtp.EnableSsl = true;
                        smtp.UseDefaultCredentials = false;
                        smtp.Credentials = nc;
            
                        mail.To.Add("shreeraje2345@gmail.com");
                        mail.From = new MailAddress(txtEmail.Text);
                        mail.Subject = txtName.Text;
            
                        string body = "From: " + txtName.Text + "\\n";
                        body += "Email: " + txtEmail.Text + "\\n";
                        body += "Applied For Job ID: " + lblJobId.Text + "\\n";
                        body += "Applied For Job Position: " + lblJobName.Text + "\\n";
                        body += "DOB:" + txtDOB.Text + "\\n";
                        body += "Qualification:" + dllQualifn.SelectedItem.Text + "\\n";
                        body += "Specialization:" + dllSpcialn.SelectedItem.Text + "\\n";
                        body += "Address:" + txtAddress.Text + "\\n";
                        body += "Pincode:" + txtPincode.Text + "\\n";
                        body += "State:" + txtState.Text + "\\n";
                        body += "City:" + txtCity.Text + "\\n";
                        body += "Wheather Experience:" + dllW\_Exp.SelectedItem.Text + "\\n";
                        body += "Years Of Experience:" + txtY\_Exp.Text + "\\n";
                        body += "Verification Code:" + txtCaptcha.Text + "\\n";
                        mail.Body = body;
                        mail.Attachments.Add(new Attachment(PhotoUpload.FileContent, System.IO.Path.GetFileName(PhotoUpload.FileName)));
                        mail.Attachments.Add(new Attachment(ResumeUpload.FileContent, System.IO.Path.GetFileName(ResumeUpload.FileName)));
            
            
            
                        smtp.Send(mail);
                        lblMessage.Text = "Your Application has been send sucessfully";
            

            work on local host but not work when i use on godadday host [edit]Email details removed, Code block added - OriginalGriff[/edit]

            F Offline
            F Offline
            F ES Sitecore
            wrote on last edited by
            #5

            Use GoDaddy's smtp servers, not gmail http://forums.asp.net/post/5825785.aspx[^]

            1 Reply Last reply
            0
            • S Shrimants Satpute
                      MailMessage mail = new MailMessage();
                      try
                      {
                          SmtpClient smtp = new SmtpClient();
              
              
                          System.Net.NetworkCredential nc = new System.Net.NetworkCredential("\[DELETED\]@gmail.com", "\[DELETED\]");
                          smtp.Port = 587;
                          smtp.Host = "smtp.gmail.com";
                          smtp.EnableSsl = true;
                          smtp.UseDefaultCredentials = false;
                          smtp.Credentials = nc;
              
                          mail.To.Add("shreeraje2345@gmail.com");
                          mail.From = new MailAddress(txtEmail.Text);
                          mail.Subject = txtName.Text;
              
                          string body = "From: " + txtName.Text + "\\n";
                          body += "Email: " + txtEmail.Text + "\\n";
                          body += "Applied For Job ID: " + lblJobId.Text + "\\n";
                          body += "Applied For Job Position: " + lblJobName.Text + "\\n";
                          body += "DOB:" + txtDOB.Text + "\\n";
                          body += "Qualification:" + dllQualifn.SelectedItem.Text + "\\n";
                          body += "Specialization:" + dllSpcialn.SelectedItem.Text + "\\n";
                          body += "Address:" + txtAddress.Text + "\\n";
                          body += "Pincode:" + txtPincode.Text + "\\n";
                          body += "State:" + txtState.Text + "\\n";
                          body += "City:" + txtCity.Text + "\\n";
                          body += "Wheather Experience:" + dllW\_Exp.SelectedItem.Text + "\\n";
                          body += "Years Of Experience:" + txtY\_Exp.Text + "\\n";
                          body += "Verification Code:" + txtCaptcha.Text + "\\n";
                          mail.Body = body;
                          mail.Attachments.Add(new Attachment(PhotoUpload.FileContent, System.IO.Path.GetFileName(PhotoUpload.FileName)));
                          mail.Attachments.Add(new Attachment(ResumeUpload.FileContent, System.IO.Path.GetFileName(ResumeUpload.FileName)));
              
              
              
                          smtp.Send(mail);
                          lblMessage.Text = "Your Application has been send sucessfully";
              

              work on local host but not work when i use on godadday host [edit]Email details removed, Code block added - OriginalGriff[/edit]

              A Offline
              A Offline
              Afzaal Ahmad Zeeshan
              wrote on last edited by
              #6

              You should consider using their own SMTP service. Most of the users here (using GoDaddy services) have complained and raised issues in which they are not able to send emails when their applications are hosted on GoDaddy. I would recommend that you (first of all) contact the administrator (perhaps in the company he will be a customer services manager or operator), since we do not respond on their behalf it is hard to tell what you should consider doing in your case of application. Indeed the code you show works (as stated in the post itself). The problem will be with the services being provided to you, maybe your application isn't provided with the feature for sending emails at all, or to communicate with SMTP servers etc. http://forums.asp.net/post/5825785.aspx[^] https://pk.godaddy.com/help/workspace-email[^]

              The shit I complain about It's like there ain't a cloud in the sky and it's raining out - Eminem ~! Firewall !~

              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