I'm trying to get this G1ANT robot to retrieve unread emails from a test email ID, however the retrieved list ♥list has a count of zero even when there are two unread emails. How do I get around this? No error messages are displayed as well.
I tried using imap.getemails instead of mail.imap command also, yet it returns the same results. Here is the code for that line:
mail.imap imap.getmails host imap.gmail.com port 993 login ♥login password ♥password onlyunreadmessages true sincedate ♥date ignorecertificateerrors true result ♥list
IMAP is enabled on the email address.
Here is the code:
addon net version 4.101.0.0
addon selenium version 4.101.0.0
addon core version 4.101.0.0
addon language version 4.103.0.0
♥login=idgoeshere
♥password=passwordhere
mail.imap imap.gmail.com login ♥login password ♥password sincedate ♥date onlyunreadmessages true ignorecertificateerrors true result ♥list
foreach ♥email in ♥list
dialog ♥email
end
No error messages were shown, simply the automation ends.
The problem is that ♥date is a special variable in G1ANT containing the today date. It means that it can't find any emails after today because there was no day after today yet.
Use some direct value instead, for example 16/08/2019 and be sure to use errorcall argument as you will probably encounter the exception:
The folder is not currently open in read-write mode.
You can just ignore it by creating an empty procedure like in the following.
mail.imap imap.gmail.com login ♥login password ♥password sincedate ‴16/08/2019‴ onlyunreadmessages true ignorecertificateerrors true errorcall IgnoreError
foreach ♥email in ♥result
dialog ♥email
end
procedure IgnoreError
end procedure
Please use new imap command.
imap.open imap.gmail.com login ♥login password ♥password ignorecertificateerrors true
imap.getmails
imap.close
Related
I have a problem about python3_anticaptcha (api provided by anti-captcha.com), search on web, find support and try over a month but no luck.
API doc:
https://anticaptcha.atlassian.net/wiki/spaces/API/pages/416972814/GeeTestTaskProxyless+-+captcha+from+geetest.com+without+proxy
I am doing a auto login on a website, and copy the api on anti-captcha's doc:
def runGee(self, challenge):
print("start gee")
try:
# Enter the key to the AntiCaptcha service from your account. Anticaptcha service key.
ANTICAPTCHA_KEY = "mycode"
# обязательные параметры
websiteURL = "https:\/\/www.nike.com.hk"
gt = "2328764cdf162e8e60cc0b04383fef81"
print("sloving1")
print("challenge:" ,challenge)
# пример работы с GeeTestTask без прокси
result = GeeTestTaskProxyless.GeeTestTaskProxyless(anticaptcha_key=ANTICAPTCHA_KEY,
websiteURL=websiteURL,
gt=gt).captcha_handler(challenge=challenge)
print("sloving2")
print(result)
print("--end gee--")
except Exception as err:
print(err)
print("--end with error--")
However, the geetask start over 3 minute(or more), and got error everytime. usually error code like:
{'errorId': 34, 'errorCode': 'ERROR_TOKEN_EXPIRED', 'errorDescription': 'Captcha provider
reported that additional variable token has expired.', 'taskId': 1204556667}
or
{'errorId': 12, 'errorCode': 'ERROR_CAPTCHA_UNSOLVABLE', 'errorDescription': ' Captcha
could not be solved by 5 different workers.', 'taskId': 1204060350}
..etc
depends on what parameter i passed.
May i know am i passing the right value to geetask? or some wrong on the code?
Moreover, if geetest return the correct value, i need to do any else to pass capcha(or pass code to geetest server) or GeeTestTaskProxyless already done(not to do anything)?
it is extremely hard to me, does anyone had used this api successfully? Thanks
The problem is not in the anticaptcha but in the geetest provider.
The token challenger can only be used once, when your browser loads the geetest captcha it expires the token.
To fix this problem, you only need to block the request that consumes the token in your browser.
go to devtools and add the block for the geestest captcha API in the browser, like this:
You can automatically integrate this into the selenium with the following command:
driver.execute_cdp_cmd('Network.setBlockedURLs', {"urls": ["api.geetest.com/get.php"]})
driver.execute_cdp_cmd('Network.enable', {})
It seems for me that those errors are because of proxy (if you use any) or just bad IP.
Personally, I use another captcha service and I didn't have such problems with it.
I advice you to try it, it's actually much easier: https://2captcha.com/2captcha-api#solving_geetest
You should send a request like this one:
https://2captcha.com/in.php?key=1abc234de56fab7c89012d34e56fa7b8&method=geetest>=f1ab2cdefa3456789012345b6c78d90e&challenge=12345678abc90123d45678ef90123a456b&api_server=api-na.geetest.com&pageurl=https://www.example.com/page/
What you need to archieve is to get correct answer from it, like this one:
{
"challenge":"1a2b3456cd67890e12345fab678901c2de",
"validate":"09fe8d7c6ba54f32e1dcb0a9fedc8765",
"seccode":"12fe3d4c56789ba01f2e345d6789c012|jordan" }
Then you just need to implement that answer on a site. Just read the first link I gave you.
Cheers.
On Excel I have a table that uses MySQL Connector/ODBC to get external data from a database.
If the connection fails when I refresh it the MySQL Connector/ODBC Data Source Configuration window appears.
Instead of that I want to present the user with a custom error message.
Checking if the refresh was successful after refreshing is too late to prevent the window so I ping the server before refreshing and cancel the refresh if the ping fails.
My question is if there's a more reliable/standard way to not show the window when there's no connection. I don't want to write the password on my code for security reasons (the connection is made with a DSN) and I don't know if the ping trick will always work or if it might rarely give unexpected errors or results.
Also I think it's technically or theoretically possible that the connection status changes between the ping check and the refresh even though that wouldn't be the end of the world (if that was even possible between the fast running code).
Code example for anyone asking:
Sub Table()
Sheets(1).ListObjects.Add(SourceType:=0, Source:="ODBC;DSN=connection_test;", Destination:=Range("A1")).QueryTable.CommandText = Array("SELECT table_test_0.`column _test` FROM db_test.table_test table_test_0")
End Sub
Sub Refresh()
Sheets(1).ListObjects(1).QueryTable.Refresh
End Sub
I am trying to send a 2nd email to my sites admin when a user registers.
I made a postHook snippet that sends an email but it didnt work - the Registration process worked as expected, but I got no 2nd email from the hook.
In testing I set the hook from postHook to preHook and tried again - this time the form didnt process at all - no new user was created and no activation email was sent. It didnt even redirect to the submittedResourceId.
So, I deleted everything in my preHook Snippet, except the return true; and tried again - still nothing.
It appears Login wont run any Hooks at all. I have no idea why.
Would anyone be able to suggest any fixes?
My register snippet is:
[[!Register?
&submitVar=`registerbtn`
&activationResourceId=`19`
&activationEmailTpl=`lgnActivateEmailTpl`
&activationEmailSubject=`Thanks for Registering!`
&submittedResourceId=`23`
&usergroups=`2`
&validate=`nospam:blank,
username:required:minLength=^6^,
password:required:minLength=^6^,
password_confirm:password_confirm=^password^,
fullname:required,
email:required:email`
&preHooks=`adminEmailHook`
]]
I've done something similar before. There is my code:
[[!Register? &postHooks=`sendMessageToAdmin`
Snippet sendMessageToAdmin:
<?php
$message = 'Auto message:<br><br>A new user signed up: '.$hook->getValue('fullname') . ', using email address '.$hook->getValue('email').'.';
$modx->getService('mail', 'mail.modPHPMailer');
$modx->mail->set(modMail::MAIL_BODY,$message);
$modx->mail->set(modMail::MAIL_FROM,'info#domain.com');
$modx->mail->set(modMail::MAIL_FROM_NAME,'My website');
$modx->mail->set(modMail::MAIL_SENDER,'Auto message from my website');
$modx->mail->set(modMail::MAIL_SUBJECT,'Someone signed up');
$modx->mail->address('to','info#domain.com');
$modx->mail->setHTML(true);
if (!$modx->mail->send()) {
$modx->log(modX::LOG_LEVEL_ERROR,'sendMessageToAdmin: An error occurred while trying to send the email: '.$err);
}
$modx->mail->reset();
/* tell our snippet we're good and can continue */
return true;
I am using poplib in Python 3.3 to fetch emails from a gmail account and everything is working well, except that the mails are not marked as read after retrieving them with the retr() method, despite the fact that the documentation says "Retrieve whole message number which, and set its seen flag."
Here is the code:
pop = poplib.POP3_SSL("pop.gmail.com", "995")
pop.user("recent:mymail#gmail.com")
pop.pass_("mypassword")
numMessages = len(pop.list()[1])
for i in range(numMessages):
for j in pop.retr(i+1)[1]:
print(j)
pop.quit()
Am I doing something wrong or does the documentation lie? (or, did I just misinterpret it?)
The POP protocol has no concept of "read" or "unread" messages; the LIST command simply shows all existing messages. You may want to use another protocol, like IMAP, if the server supports it.
You could delete messages after successful retrieval, using the DELE command. Only after a successful QUIT command will the server actually delete them.
I am downloading a message from Gmail using the following IMAP command:
UID FETCH 8590 (FLAGS UID RFC822.SIZE INTERNALDATE BODY.PEEK[HEADER] BODY)
Works great, except for one issue:
Message FLAGS are always returned as Seen even when they are Unseen.
Is there something I missing from the command above to return
correct flags for the message?
I have just checked with the exactly same command (except the UID) and I cannot reproduce that on my gmail account. Are you sure you aren't accessing other BODY items elsewhere without the .PEEK modifier?