0

I'm trying to send an email using C++/Cli through gMAil ... This is the code but it is not working , any suggestions?

MailMessage^ email=gcnew     
MailMessage("[email protected]","[email protected]","SUBJECT","MESSAGE");
SmtpClient^ smtp=gcnew SmtpClient("smtp.gmail.com", 587);
smtp->EnableSsl=true;   
smtp->UseDefaultCredentials = false; 
smtp->Credentials = gcnew    
System::Net::NetworkCredential("[email protected]","password");
smtp->Send(email); 
2
  • there is a proxy present... how to overcome this, the proxy uses port 80 Feb 24, 2014 at 9:23
  • You can try to specify a proxy in your .config file: stackoverflow.com/questions/186800/… .... but I doubt that your proxy-server will allo CONNECT requests... Normally you have no chance to access SMTP portes directly via a proxy server... Feb 24, 2014 at 10:17

1 Answer 1

0

First a small comment: You are not using C++, you are using C++/CLI (.NET).

For a solution, see answer of: SmtpClient wont authenticate over SSL/TLS (not pointing to gmail)

Alternatively: How can I send emails through SSL SMTP with the .NET Framework?

If you have a proxy server, you are normally without luck... of course, you can try to specify a proxy server in your config file. For more info see: Is it possible to specify proxy credentials in your web.config? But normally your proxy server will not allow CONNECT reqeusts...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.