how to send a string to my gmail?
as the title says, i wrote a program that stores whats inside a text file in a string and im trying to send whats stored in the string to my gmail or even a private host. ive this using windows form application, however i dont care if its through windows form or console. i get this error when i click the button
An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll
Additional information: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at
An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll
Additional information: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at
Code:
MailMessage^ mail = gcnew MailMessage("mygmail@gmail.com", "mygmail@gmail.com", "subject test", "body test, i want my string here");
SmtpClient^ client = gcnew SmtpClient("smtp.gmail.com");
client->Port = 587;
client->Credentials = gcnew System::Net::NetworkCredential();
client->EnableSsl = true;
client->Send(mail);
