Google Apps email / smtp issue for sending emails from a website

I have an Asp.Net site that uses Google SMTP to send emails .. its working fine with regular gmail accounts using the configuration below

<smtp from="myname@gmail.com">
<network host="smtp.gmail.com" port="587" userName="myname@gmail.com" password="mypassword" enableSsl="true" /></smtp>

Now I need to use Google Apps email and smtp, and I tried to change the configuration as shown below.

<smtp from="myname@mydomain.com">
    <network host="smtp.gmail.com" port="587" userName="myname@mydomain.com" password="mypassword" enableSsl="true" /> </smtp>

But its error Authentication Error !!!

"The SMTP server requires a secure connection or the client has not been authenticated. Server response: 5.5.1 Authentication is required. Read more in the"

I checked Google’s email parameters, username and password twice, but still couldn’t solve it!

Any thoughts on this would be a big help.

,

+3
2

MSDN:

SMTP- , . , SmtpClient . UseDefaultCredentials false, , Credentials .


    client.UseDefaultCredentials = false;
    smtp.EnableSsl = true;
    client.Credentials = new System.Net.NetworkCredential(username, password);
    ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; }; 

    smtp.Send(mail);

.

+3

( ). , / , /. , API Google?

0

All Articles