c# - Issue using MailKit to fetch gmail emails -
i 'm working on mvc application fetch emails gmail account using mailkit, on local computer works perfectly. however, when uploading on host "a socket operation attempted unreachable network". don't have ssl enabled on host. suggestions appreciated have crawled web , tried solutions s22.imap.dll still same error.
using (var client = new imapclient()) { using (var cancel = new cancellationtokensource()) { // demo-purposes, accept ssl certificates client.servercertificatevalidationcallback = (s, c, h, e) => true; var ips = dns.gethostaddresses("imap.gmail.com"); try { client.connect("imap.gmail.com", 993, true, cancel.token); } catch { foreach (var ip in ips) { try { client.connect(ip.tostring(), 993, true, cancel.token); } catch (socketexception e) //error means server down, try other ip { //nothing, check next ip connection } } } // note: since don't have oauth2 token, disable // xoauth2 authentication mechanism. client.authenticationmechanisms.remove("xoauth2"); client.authenticate(username, password);}}
is ssl problem ? appreciate can
regards,
Comments
Post a Comment