Email Sending
-
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]
-
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]
You have left your email address and the password visible in your code!
-
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]
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...
-
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]
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[^]
-
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]
Use GoDaddy's smtp servers, not gmail http://forums.asp.net/post/5825785.aspx[^]
-
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]
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 !~