I'm trying to send an e-mail from a managed application.
I found the following example:
MailAddress ^From = gcnew MailAddress("firstname.lastname@example.org"); MailAddress ^To = gcnew MailAddress("email@example.com"); MailMessage ^message = gcnew MailMessage(From, To); message->Subject = "Testing sending mail"; message->Body = "Body of message"; SmtpClient^ client = gcnew SmtpClient( "smtp.foo.com" ); client->Credentials = CredentialCache::DefaultNetworkCredentials; client->Send( message ); client->~SmtpClient();
I don't know how to set the DefaultNetworkCredentials in fact.
What I have for authentification is a a login name and a password for the SMTP server.
How do I use them?