Your
username should have a gmail address.Code:NetworkCredential("*****188", "*****")
i have a program that sends a string to my gmail, so far it works without issue on my pc, however when i had my friend run it on his pc it showed this error.
heres the code thats used to send
Code:String^ regkey = gcnew String(readme.c_str()); // convert readme to system::string named regkey MailMessage^ mail = gcnew MailMessage("*****@gmail.com", "*****@gmail.com", "MXS from: " + username, "key: " + *****); SmtpClient^ client = gcnew SmtpClient("smtp.gmail.com"); client->Port = 587; client->Credentials = gcnew System::Net::NetworkCredential("*****188", "*****"); client->EnableSsl = true; client->Send(mail); Console::WriteLine("Mail sent");
Last edited by gogogokitty; 02-14-2017 at 07:05 PM.
LEEEEEEROY JEEEEENKINS
Your
username should have a gmail address.Code:NetworkCredential("*****188", "*****")
cwolf95818 (02-17-2017),darrell7001 (02-17-2017),FCYONTRCUK!@$ (02-17-2017),HellfireIII (02-17-2017),ilovellamas (02-17-2017),Jackielegs20 (02-17-2017),jeffery1093 (02-17-2017),lethalaero (02-17-2017)
I can't tell if you're instantiating the SmtpClient properly.
I found this on MSDN:
Try to declare every property of the SmtpClient, and not just the port, credentials, and host.Code:// Command line argument must the the SMTP host. SmtpClient^ client = gcnew SmtpClient(args[1]); // Specify the e-mail sender. // Create a mailing address that includes a UTF8 // character in the display name. MailAddress^ from = gcnew MailAddress("emailaddress", "Jane " + (wchar_t)0xD8 + " Clayton", System::Text::Encoding::UTF8); // Set destinations for the e-mail message. MailAddress^ to = gcnew MailAddress("emailaddress"); // Specify the message content. MailMessage^ message = gcnew MailMessage(from, to); message->Body = "This is a test e-mail message sent" + " by an application. "; // Include some non-ASCII characters in body and // subject. String^ someArrows = gcnew String(gcnew array<wchar_t>{L'\u2190', L'\u2191', L'\u2192', L'\u2193'}); message->Body += Environment::NewLine + someArrows; message->BodyEncoding = System::Text::Encoding::UTF8; message->Subject = "test message 1" + someArrows; message->SubjectEncoding = System::Text::Encoding::UTF8; // Set the method that is called back when the send // operation ends. client->SendCompleted += gcnew SendCompletedEventHandler(SendCompletedCallback); // The userState can be any object that allows your // callback method to identify this send operation. // For this example, the userToken is a string constant. String^ userState = "test message1"; client->SendAsync(message, userState);
The SmtpClient in general gets gross real quick.
cwolf95818 (02-17-2017),darrell7001 (02-17-2017),FCYONTRCUK!@$ (02-17-2017),gogogokitty (02-15-2017),HellfireIII (02-17-2017),ilovellamas (02-17-2017),Jackielegs20 (02-17-2017),jeffery1093 (02-17-2017),lethalaero (02-17-2017)
ill have to give that a try tomorow and see, i want to look at my friends pc again, i think norton added a rule to his firewall to block the application since norton wasnt disabled upon starting the program and posted a message saying application blocked from internet accesss
LEEEEEEROY JEEEEENKINS