0

I am trying to create a mail sending application in C# using SMTP. I don't understand what parameters I should introduce in this declaration instead of username and password:

SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");

Is it the email, computer or literally the internet connection credentials?

FaizanHussainRabbani
  • 3,256
  • 3
  • 26
  • 46
AndreiSold
  • 25
  • 1
  • 6
  • 1
    What do you mean "instead of"? Did you try providing the username and password? What was the result? Did you get an error? Are you using an SMTP server you control, or is it hosted somewhere? – mason Feb 21 '18 at 14:17
  • I am using the client smtp.gmail.com and the port 587 – AndreiSold Feb 21 '18 at 14:21

1 Answers1

-2

In this line you need to use if u want to send mail from gmail then use GmailId username and Gmail password on that 2 strings ,if you replace that 2 strings it will works fine please try like below

SmtpClient.Credentials = new System.Net.NetworkCredential("yourgmailusername", "yourgmailpassword");

Khadar Sk
  • 1
  • 2