Mailkit SearchQuery IMAP BAD Command Argument Error. 11 - mailkit

Is there anything wrong with this query?
zSQry = SearchQuery.Seen.And(SearchQuery.SubjectContains("spain").And(SearchQuery.DeliveredAfter(New Date(2017, 3, 11))))
I´m getting "BAD" from server
S: A00000005 OK [READ-ONLY] EXAMINE completed.
C: A00000006 UID SEARCH CHARSET US-ASCII SEEN SUBJECT spain SINCE 11-MAR-2017
S: A00000006 BAD Command Argument Error. 11
C: A00000007 LOGOUT
S: * BYE Microsoft Exchange Server 2016 IMAP4 server signing off.
Or this kind of search is not valid.

Oops my bad, a little mistake in my searchquery construct, but an interesting aspect to note, because there was no compilation error in VS2005.
This is the initial search query, nothing wrong with sintax at IDE, but produces an error at server
SearchQuery.Seen.And(SearchQuery.SubjectContains("paulistana").And(SearchQuery.DeliveredAfter(New Date(2017, 3, 11))))
Now with a small change (parentesis in bold), it works perfect
SearchQuery.Seen.And(SearchQuery.SubjectContains("paulistana")).And(SearchQuery.DeliveredAfter(New Date(2017, 3, 11)))
First produces (double space between SEEN and SUBJECT)
C: A00000006 UID SEARCH CHARSET US-ASCII SEEN SUBJECT spain SINCE 11-MAR-2017
Second produces (single space)
C: A00000006 UID SEARCH CHARSET US-ASCII SEEN SUBJECT spain SINCE 11-MAR-2017

Ooops, hold on, it´s been a long time I'm using mailkit. Since 2015.
That´s why you can´t reproduce with current version.
I´m on 1.2.12.0, so have to reconsider and upgrade.
I´ll check with current version.
No need to open an issue, thanks to refresh me.

Related

I'm trying to create a blog page with hugo it gives some annoying errors

This is the config file
baseURL = "https://.github.io/"
languageCode = "en-us"
title = "Title"
theme="hugo-PaperMod"
[[params=]]
[[homeInfoParams=]]
Title= "Hi there wave"
Content= "Can be Info, links, about..."
[[socialIcons=]]
- name= "github"
url= "<link>"
- name= "<platform 2>"
url= "<link2>"
This is the error on the powershell
ERROR 2021/08/15 17:40:30 "C:\Users\user\Desktop\blog\webapp\config.toml:5:9": unmarshal failed: toml: expected character U+005D
Rebuilt in 1 ms
I'm a total beginner in this area its most likely a basic thing but i can't figure it out.
TLDR; Take the equals signs out of your config's toml.
P.s. Their are no equals signs in the [[]] statements.
Some advice:
If your code doesn't work, verify your code (validate)-
https://www.toml-lint.com/
If you don't understand the language syntax when the validator gives you errors, check your specific misunderstanding in that language (that linter will give you more data).
https://github.com/toml-lang/toml
As it's hugo and they have pre-built config files for you to review, review what other people have done that does work:
https://gohugo.io/getting-started/configuration/#readout
https://themes.gohugo.io/
Additional, when looking at your question and the wider sphere:
Why do you say annoying error? English isn't my first language. But it's telling you that your toml is miswritten so it can't parse it. The more accurate information you give the more accurate information you will get back from others in the field.
So, a better example would be (and this is an idea):
"HUGO Config.toml errors, uncertain of correct syntax"

Bcrypt Invalid Salt and Postgresql

I have a little Flask app (Python3) that is starting to get a little more complicated so I decided to switch from SQLite to Postgresql. I knew this would throw a few issues for me but my codebase has decent test coverage so I was confident I could iron out any wrinkles before pushing to production.
In particular, anywhere I entered a password, I had to encode (password.encode('utf-8')).
(As an aside, timezones was the other area I had some issues. I ultimately ended up removing timezones from any date I was using.)
But there's just one last bug I can't figure out. To test that passwords are updated I have the following test:
self.assertTrue(bcrypt.check_password_hash(
user.password, new_password
))
That should check the current password (which looks like a bytes sting when I print it) against the new_password. But I get an error saying ValueError: Invalid salt
I'd love to know how to fix this but I'd also love someone to explain what's going on here.
So it turns out the problem was the way I was saving the password. In this particular instance I should have saved the password like so:
user.password = bcrypt.generate_password_hash(
request.form['password']
).decode('utf-8')
db.session.commit()
Now the test above works.

Registration form phpmailer and e-mail length

First of all i'd like to apologise for my english. I am student from Poland and i don't know php but i need something from code. http://pastebin.com/x0vUhj8V
I have encoutered a problem. On my website i can't register with mail which is shorther than (i miss word but here is example) - asd#wp.pl, asd#op.pl, asd#vp.pl
it also concern the part which is before "#" mark (asd) and after (wp.pl, op.pl, vp.pl) -3characters is minimum what is accepted for example asd#asd.pl.
I think somewhere in the code is declareted minimum length of e-mail or something, but with my "knowledge" od PHP I can't figure out which part... If someone could explain me what should i change i would be gratefull. Please help
Edit: My fault, here is code http://pastebin.com/dhGgZkPB that is used to call phpMailer.
Your English is just fine!
That version of PHPMailer is really old, over 10 years out of date. Get the latest from here. Beyond that you have not posted the code you're using to call PHPMailer so we can't say what you're doing wrong - if you need somewhere to start, look at the documentation examples here.
There is no particular lower length limit on email messages or addresses (so long as they are valid) - you can quite reasonably send a message containing 'a' to someone at 'a#a.co'.

Cakephp Account Activation Email - Address Not Found On Server

For our website, we set up the account activation email with the following tutorial (in cakephp):
http://www.jonnyreeves.co.uk/2008/06/cakephp-activating-user-account-via-email/
On our live site, it seems that the activation works for the most part, however some people are receiving the following error when clicking on the activation email link to activate their account:
Error: The requested address '/users/activate/36/10a1a794' was not found on this server.
This is odd to me because the link looks fine: "users" controller, "activate" action, user_id = 36, and hash code = 0a1a794. Not sure why this error is happening. One thing I read is to clear the files in the cache folder and that didn't seem to change anything. Please help thanks!
The activation hash has limited validity(same day).
So if send the activation email on 1st of any month, it will be valid till 11:59pm of 1st. The link wont work after 12:00am(technically 2nd of the month).
Hope that helps.
Yes, that's what Josh R said, the hash is computed for the same day and this is a VERY bad idea.
You should either stop hashing the date or validate against two values: one for today's date, one for yesterday's date.
Also, a recommendation: don't just go there and copy the files, try to learn something from it and please, do it your way. You'll learn a lot more.

PostgreSQL UTF8 Handling

From time time to time my PostgreSQL DB is reporting a strange error:
[client] postgres7 error: [-1: ERROR: invalid byte sequence for encoding \"UTF8\": 0xb4
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by \"client_encoding\".] in adodb_throw(INSERT INTO
page_comments(pageid, pagetype, sender_name, sender_mail, sender_url, comment, owner_uid, owner_gid, sortorder, level, parent)
VALUES(
1493,
102,
\'alexis\',
\'xxx#xxx.es\',
\'\',
\'Next friday i´ll visit Barcelona so in case you need one of this mugs please let me know.\',
1000,
1000,
1,
1,
NULL
), )
Now, I see that it is coming from the funny apostrophe sign. Yet I am totally confused, as the DB was initialized in UTF8, the web application is serving UTF8 pages, and, moreover, the content is being even utf8_encoded before it is pushed into the database.
Does anybody know how to avoid this error?
U+00B4, ACUTE ACCENT, is encoded as '\xb4' in ISO-8859-1. In UTF-8, it would be '\xc2\xb4'. So some part of your application changes the encoding to Latin-1. Find and fix that place, and the error should go away.