D
function readEmails(emailAccount, count=10):
# 1. ENSURE PROXY IS ALIVE (retries forever)
proxy = getDefaultProxy()
getProxyIp(proxy) // confirm proxy responds, never timeout
# 2. GET A FRESH ACCESS TOKEN
# POST to https://login.microsoftonline.com/common/oauth2/v2.0/token
# with: client_id, refresh_token, grant_type="refresh_token"
# → returns short-lived access_token (good for ~1 hour)
# request goes through proxy via HTTP CONNECT tunnel
tokenResult = refreshToken(emailAccount, proxy)
accessToken = tokenResult.accessToken
# 3. CONNECT TO POP3 SERVER
# Two paths depending on proxy:
#
# WITH PROXY:
# a. TCP connect to proxy host:port
# b. Send "CONNECT outlook.office365.com:995 HTTP/1.1"
# with Proxy-Authorization: Basic base64(user:pass)
# c. Wait for "HTTP/1.1 200" response
# d. Upgrade the TCP socket to TLS (servername: outlook.office365.com)
# e. Wait for POP3 "+OK" greeting
#
# WITHOUT PROXY:
# a. TLS connect directly to outlook.office365.com:995
# b. Wait for POP3 "+OK" greeting
pop3.connect(proxy)
# 4. AUTHENTICATE VIA XOAUTH2
# Build SASL string: "user=email\x01auth=Bearer access_token\x01\x01"
# Base64 encode it
# Send: AUTH XOAUTH2
# Server responds: + (ready for credentials)
# Send: base64_encoded_sasl_string
# Server responds: +OK (authenticated)
pop3.authXOAuth2(email.email, accessToken)
# 5. LIST & FETCH MESSAGES
# Send: LIST → get message numbers
# For each of the last N messages:
# Send: RETR msgNum → get raw email lines
# Parse headers (Subject, From, Date, Message-ID)
# Parse body (handle multipart/mixed, base64, quoted-printable)
msgNums = pop3.list()
for msgNum in last N of msgNums:
rawLines = pop3.retr(msgNum)
parsed = parseEmail(rawLines)
# 6. DISCONNECT
pop3.quit()
return parsed emails (newest first)
function refreshToken(emailAccount, proxy?):
body = urlencoded {
client_id: emailAccount.client_id,
refresh_token: emailAccount.refresh_token,
grant_type: "refresh_token",
redirect_uri: "https://login.microsoftonline.com/common/oauth2/nativeclient"
}
# WITH PROXY (HTTP CONNECT tunnel):
# 1. TCP connect to proxy
# 2. "CONNECT login.microsoftonline.com:443 HTTP/1.1"
# 3. Wait for 200
# 4. TLS upgrade over the tunnel
# 5. Raw HTTP POST /common/oauth2/v2.0/token over TLS socket
# 6. Read response, strip HTTP headers, parse JSON
#
# WITHOUT PROXY:
# Standard Node https.request POST
response = JSON.parse(httpResponse)
return response.access_token
function createXOAuth2String(email, accessToken):
raw = "user=" + email + "\x01" + "auth=Bearer " + accessToken + "\x01\x01"
return base64(raw)
selenium?In my automation, I programmed it to press and only release when the verified image appears. It's been working for over 4 months.
Have you tried some AI solution? There's AI that takes over the browser these days
Hi, I fixed it. I am using undetected chromedriver, each keystores and clicks are randomized by miliseconds, when I select dropbox I move mouse around randomly and then simply click and hold it. it works, you definitely need to randomize the process in order to make it look like a person and you need stealth browser like undetected chromedriver, nodriver, etc.Any update op, I encounterd same issue here
Apprecaited bro, then how do y detect the click area etc, i guess it maybe some kind of shadow dom? and y detect it directtly from python?Hi, I fixed it. I am using undetected chromedriver, each keystores and clicks are randomized by miliseconds, when I select dropbox I move mouse around randomly and then simply click and hold it. it works, you definitely need to randomize the process in order to make it look like a person and you need stealth browser like undetected chromedriver, nodriver, etc.
I am sending you through DMApprecaited bro, then how do y detect the click area etc, i guess it maybe some kind of shadow dom? and y detect it directtly from python?