Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't Send Emails From my Website
    primarykey
    data
    text
    <p>Here I am in a strange situation. When I send the email from localhost it is working fine but when I upload the page to the server and try to send email, I get the following error </p> <blockquote> <p>The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required</p> </blockquote> <p>I'm displaying the error message in a label for testing purpose and the try is also misplaced I know, I will set it later.</p> <p>the code I am using is </p> <pre><code> if (Page.IsValid) { try { StringBuilder message = new StringBuilder(); message.Append("Hello My Name is "); message.Append(txtName.Text); message.AppendLine(); message.AppendLine("My Contact Number " + txtContactNumber.Text.ToString()); message.AppendLine(); message.AppendLine(); message.AppendLine("My Email Id Is " + txtFromEmailAddress.Text.ToString()); message.AppendLine(); message.Append(txtEmailBody.Text); MailMessage mailMessage = new MailMessage("xxx@gmail.com", "yyy@gmail.com"); mailMessage.Subject = "New Client Query"; mailMessage.Body = message.ToString(); SmtpClient smtpClient = new SmtpClient("smtp.gmail.com", 25); //smtpClient.UseDefaultCredentials = true; smtpClient.Credentials = new System.Net.NetworkCredential() { UserName = "xxx@gmail.com", Password = "password" }; smtpClient.EnableSsl = true; smtpClient.Send(mailMessage); txtContactNumber.Text = ""; txtFromEmailAddress.Text = ""; txtName.Text = ""; txtEmailBody.Text = ""; lblEmailStatus.Text = "Email Sent Successfully."; lblEmailStatus.ForeColor = System.Drawing.Color.Yellow; } catch(Exception ex) { lblEmailStatus.Text = ex.Message + " &lt;br&gt; " + ex.Source; } } else { lblEmailStatus.Text = "Error! Email Not Sent "; lblEmailStatus.ForeColor = System.Drawing.Color.Yellow; } </code></pre> <p>I have googled for a couple of hours and checked links at this site as well but I still cant figure it out.</p> <p>Now I request you guys here if any one have any solutions / hint.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload