windows form, 2 issues. getline no instance of overloaded function

Posts 1–6 of 6 · Page 1 of 1
sending mail works on my pc to my gmail, but not from my friends pc
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");
Your
Code:
NetworkCredential("*****188", "*****")
username should have a gmail address.
Quote Originally Posted by Maysen View Post
Your
Code:
NetworkCredential("*****188", "*****")
username should have a gmail address.
gotcha. i see why that would cause the issue, im an idiot. just changed that, testing now when i find a friend thats online
Quote Originally Posted by Maysen View Post
Your
Code:
NetworkCredential("*****188", "*****")
username should have a gmail address.
just had him try it, it threw this error which is different, failed sending mail, he had to pause norton to try it because it blocked
I can't tell if you're instantiating the SmtpClient properly.

I found this on MSDN:
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);
Try to declare every property of the SmtpClient, and not just the port, credentials, and host.
The SmtpClient in general gets gross real quick.
Quote Originally Posted by Maysen View Post
I can't tell if you're instantiating the SmtpClient properly.

I found this on MSDN:
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);
Try to declare every property of the SmtpClient, and not just the port, credentials, and host.
The SmtpClient in general gets gross real quick.
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
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us