I have a strange problem with my IMAP authentication here. I cannot authenticate if I´m trying to use string variables. I really need to type in my account and my password which does really make no sense to me.
THIS DOES NOT WORK!
using (var client = new ImapClient(new ProtocolLogger("imap.log")))
{
using (var cancel = new CancellationTokenSource())
{
//LogIn
client.Connect("imap.gmail.com", 993, MailKit.Security.SecureSocketOptions.SslOnConnect);
var credentials = new NetworkCredential(username, password);
client.Authenticate(credentials, cancel.Token);
var personal = client.GetFolder(client.PersonalNamespaces[0]);
f1.tbl_folderTableAdapter1.Insert(ID, PARENTID, username);
client.Disconnect(true);
}
}
BUT THIS WORK
using (var client = new ImapClient(new ProtocolLogger("imap.log")))
{
using (var cancel = new CancellationTokenSource())
{
//LogIn
client.Connect("imap.gmail.com", 993, MailKit.Security.SecureSocketOptions.SslOnConnect);
client.Authenticate("funnyemailhere", "anothernicepasswordhere");
var personal = client.GetFolder(client.PersonalNamespaces[0]);
f1.tbl_folderTableAdapter1.Insert(ID, PARENTID, username);
client.Disconnect(true);
}
}
Can you see any problems here ?
Thank you in advance