0

I have tried gmail, yahoo, and hotmail hosts, and I'm 100% sure that my username and password is correct. But no matter how I tried, I could NEVER get my credential authenticated.

It keep showing me this error:

enter image description here

The Chinese part roughly means "SMTP Server Required a Secure Connection, or the Client Credential is not Authenticated. Server Replies: 5.7.1"

Where did I go wrong?

halfer
  • 19,824
  • 17
  • 99
  • 186
Pikachu620
  • 483
  • 4
  • 17
  • Verify that port 587 exists through your network administrator. – jegtugado Feb 09 '18 at 04:15
  • My code looks similar, except I don't have client.EnableSsl = true; and it works. – Richard Mneyan Feb 09 '18 at 04:25
  • I added those codes latter one by one after the first 2000 tries had failed! So... it still won't work without those parts! >" – Pikachu620 Feb 09 '18 at 04:59
  • Gmail is using a security approach when less secure apps want to access. Did you try to ON the "Allow less secure apps" in your gmail? – TraxX Feb 09 '18 at 05:10
  • Stop pasting images, its annoying, paste code and errors messages – TheGeneral Feb 09 '18 at 05:17
  • @TraxX: I DID go enable the option! And it STILL can NOT be authenticated!!! WHY!?!?!? – Pikachu620 Feb 09 '18 at 05:17
  • No its not a third-party app. It is in the google security options. Go to myaccount.google.com > Sign in & Security > Apps with Account access. – TraxX Feb 09 '18 at 05:19
  • @Michael: Annoying!? Can you tell me why!? And why do they offer the option if we are NOT allowed to use it!?!?!? – Pikachu620 Feb 09 '18 at 05:20
  • Restart your app after turning ON the option. – TraxX Feb 09 '18 at 05:24
  • @Pikachu620 The option is primarily for the need to show content that cant be put into text. search engines cant search text in images. and its annoying because its hard to read, you cant copy and paste the code to test it. ect ect ect – TheGeneral Feb 09 '18 at 05:40
  • @Michael: I got your point! Will improve upon it!!! – Pikachu620 Feb 09 '18 at 05:53

1 Answers1

1

Try to declare your client.Credentials after client.UseDefaultCredentials

client.UseDefaultCredentials = false;
client.Credentials = new blabla;

Just rearrange the codes something like you are composing email.

From
To
Subject
Email Body

then your Port, UseDefaultCredentials, Credentials and last one is Send

You have to see this similar to your problem.

TraxX
  • 382
  • 2
  • 13