0
服務器響應是:請在您的郵件客戶端中打開SMTP身份驗證。郵箱不可用。服務器響應是:請在您的郵件客戶端中啓用SMTP身份驗證
我使用某些其他服務器的SMTP細節,我的代碼託管在其他某個服務器上。當我嘗試發送郵件時它給我的錯誤,如下SMTP認證的:
郵箱無法使用。服務器響應是:請在您的郵件客戶端打開SMTP身份驗證。
System.Net.Mail.SmtpFailedRecipientsException:無法發送給所有 收件人。 ---> System.Net.Mail.SmtpFailedRecipientException:郵箱 不可用。服務器響應是:請在您的郵件客戶端中啓用SMTP 身份驗證。
Here is my code:
public void SendIntimation()
{
try
{
string strBody = MessageBody();
string strToEmail = txtEmail.Text.ToString();
string strBcc = "[email protected]";
MailMessage(strToEmail, strBcc, "Thank you for Register with us", strBody);
}
catch (Exception ex)
{
Response.Write(ex);
}
}
protected string MessageBody()
{
string strBody = "Test 123";
return strbody();
}
public void MailMessage(string strMailTo, string strMailBcc, string strSubject, string strBody)
{
try
{
MailMessage mailMsg = new MailMessage();
mailMsg.From = new MailAddress("[email protected]", "test");
mailMsg.To.Add(strMailTo);
//mailMsg.CC.Add(strMailCC);
mailMsg.Bcc.Add(strMailBcc);
mailMsg.Subject = strSubject;
mailMsg.Body = strBody;
mailMsg.Priority = MailPriority.Normal;
mailMsg.IsBodyHtml = true;
SmtpClient mailSmtp = new SmtpClient();
mailSmtp.Host = "domain.com";
mailSmtp.Port = 25;
mailSmtp.EnableSsl = true;
mailSmtp.Timeout = 90000;
mailSmtp.DeliveryMethod = SmtpDeliveryMethod.Network;
mailSmtp.UseDefaultCredentials = true;
NetworkCredential basicCredential = new
NetworkCredential("[email protected]", "password",
"domain.com");
}
catch (Exception ex)
{
Response.Write(ex);
}
}
'UseDefaultCredentials'應該是'FALSE',你需要'mailSmtp.Credentials = basicCredential;' –
此外,你需要要轉到您的Gmail帳戶,請轉到設置,然後啓用POP3/SMTP訪問我們的帳戶 –
您好@AlexK。,這是一個錯字錯誤UseDefaultCredentials爲false。 – Abhi