Results 1 to 6 of 6
  1. #1
    gogogokitty's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    1,090
    Reputation
    113
    Thanks
    3,503

    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");
    Last edited by gogogokitty; 02-14-2017 at 07:05 PM.
    LEEEEEEROY JEEEEENKINS

  2. #2
    Maysen's Avatar
    Join Date
    Feb 2017
    Gender
    male
    Location
    >> root
    Posts
    12
    Reputation
    10
    Thanks
    75
    Your
    Code:
    NetworkCredential("*****188", "*****")
    username should have a gmail address.

  3. The Following 8 Users Say Thank You to Maysen For This Useful Post:

    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)

  4. #3
    gogogokitty's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    1,090
    Reputation
    113
    Thanks
    3,503
    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
    Last edited by gogogokitty; 02-14-2017 at 08:12 PM.
    LEEEEEEROY JEEEEENKINS

  5. #4
    gogogokitty's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    1,090
    Reputation
    113
    Thanks
    3,503
    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
    LEEEEEEROY JEEEEENKINS

  6. #5
    Maysen's Avatar
    Join Date
    Feb 2017
    Gender
    male
    Location
    >> root
    Posts
    12
    Reputation
    10
    Thanks
    75
    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.

  7. The Following 9 Users Say Thank You to Maysen For This Useful Post:

    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)

  8. #6
    gogogokitty's Avatar
    Join Date
    Feb 2013
    Gender
    male
    Posts
    1,090
    Reputation
    113
    Thanks
    3,503
    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
    LEEEEEEROY JEEEEENKINS

Similar Threads

  1. Windows form come up after inject?
    By Ragehax in forum C++/C Programming
    Replies: 0
    Last Post: 04-13-2010, 05:57 AM
  2. [Tutorial] How to change colors in DotNetBar for Windows Forms
    By Invidus in forum Visual Basic Programming
    Replies: 7
    Last Post: 02-27-2010, 11:20 PM
  3. [Help] Windows 7 issue?
    By nectros in forum WarRock Discussions
    Replies: 13
    Last Post: 01-14-2010, 09:50 PM
  4. [Help]About.vb Windows Form
    By LetItRock in forum Visual Basic Programming
    Replies: 12
    Last Post: 11-12-2009, 08:36 AM
  5. Windows Forms(C++) and etc.
    By zeco in forum C++/C Programming
    Replies: 3
    Last Post: 08-09-2009, 09:52 PM