I am trying to perform IMAP SEARCH on Gmail mailbox using IMAP. In particular, I am trying to find a UID of a message with a known Message-ID header. I know this message exists, as I just added it (and I can find it the following search query Rfc822msgid:<D7DA993B.B30DC%psztxa#exmail.nottingham.ac.uk>
in Gmail UI). The problem occurs only when the Message-ID field contains "%". I've tried to quote it in several ways, with no luck:
No quoting:
SEND: "000004 UID SEARCH HEADER Message-ID <D7DA993B.B30DC%psztxa#exmail.nottingham.ac.uk>"
SEND: "\r\n"
RECV: "000004 BAD Could not parse command\r"
Backslash quoting:
SEND: "000004 UID SEARCH HEADER Message-ID <D7DA993B.B30DC\\%psztxa#exmail.nottingham.ac.uk>"
SEND: "\r\n"
RECV: "000004 BAD Could not parse command\r"
Backslash and double-quotes:
SEND: "000004 UID SEARCH HEADER Message-ID \"<D7DA993B.B30D\\%psztxa#exmail.nottingham.ac.uk>\""
SEND: "\r\n"
RECV: "000004 BAD Could not parse command\r"
Finally, using just double-quotes passes without giving error, but fails to find the message:
SEND: "000004 UID SEARCH HEADER Message-ID \"<D7DA993B.B30DC%psztxa#exmail.nottingham.ac.uk>\""
SEND: "\r\n"
RECV: "* SEARCH\r"
RECV: "000004 OK SEARCH completed (Success)\r"
Following this question I also tried to search fragments of message ID, with no luck:
HaskellNet-SSL SEND: "000004 UID SEARCH HEADER Message-ID D7DA993B.B30DC HEADER Message-ID psztxa#exmail.nottingham.ac.uk"
HaskellNet-SSL SEND: "\r\n"
HaskellNet-SSL RECV: "* SEARCH\r"
HaskellNet-SSL RECV: "000004 OK SEARCH completed (Success)\r"
How can I format a search query to find the message with '%' in Message-Id?
Related
Currently we are using SendGrid Inbound Parse to receive emails.
We handle the Inbound Parse webhook request by Azure HttpTrigger function implmented in C# (.NET 6).
When the received email is in UTF-8 encoding, everything's okay.
However, when we tried to receive email in shift_jis encoding, headers are okay,
but japanese characters in text and html are garbled.
From Inbound Parse request, we got the charsets as below:
subject: UTF-8
to: UTF-8
from: UTF-8
cc: UTF-8
html: shift_jis
text: shift_jis
And the string we got directly from request.form["text"] (or "html") was already garbled like "�e�L�X�gshiftJis-007"
(should be "テキストshiftJis-007"), so we cannot use string in request directly.
Then we tried to convert (System.Text.Encoding.Convert method) it from charset encoding (shift_jis) to utf-8,
and the result was different from original string but still unreadable "?e?L?X?gshiftJis-007".
Our questions are:
When using C# HttpTrigger Azure function to handle Inbound Parse webhook request
(request data is passed through AspNetCore.)
What encoding is in html/text string in Inbound Parse webhook request
when the email is send in encoding other than UTF-8?
How to read text and html in shift_jis encoding (or other encodings excluding UTF-8)
correctlyfrom an Inbound Parse webhook request?
Twilio Developer Evangelist here. I would recommend reaching out to the support team because it requires to investigate the payload to figure out what is going on.
I also tried to replicate the issue on my end with using send_raw option. Here's the payload, and it does contain shift_jis characters. You may be able to process the payload manually.
(stripped X-Mailer info)
'Content-Type: text/plain; charset="shift_jis"\n' +
'X-Mailer: \n' +
'Content-Transfer-Encoding: quoted-printable\n' +
'\n' +
'\n' +
'=83e=83L=83X=83gshiftJis-007\n'
When requesting data from my remote server it responds with a value inside a node with the following token , making the parsing process to fail. I manually removed the guilty string and it started working.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
...
<sFName>Bradley</sFName>
<sLName>Libbra</sLName>
...
Token:
The error raised by Savon is:
Savon::InvalidResponseError: Unable to parse response body:
(aka INFORMATION SEPARATOR TWO) is not an allowed character in XML :
[2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
Therefore your data is not XML, and any conformant XML processor must report an error such as the one you received.
You must repair the data by removing any illegal characters by treating it as text, not XML, manually or automatically before using it with any XML libraries.
See also How to parse invalid (bad / not well-formed) XML?
My original question was around Savon ruby gem. I sorted this out by changing the default response parser to :rexml. It now parses the invalid character and does not raises an exception.
But right answer would be to parse the malformed XML or ask the provider to fix it. Thanks #kjhughes
I am using mod muc_light in MongooseIM from source code(ver-3.1.0) and taking help from this article I am able to perform the below operations successfully without any trouble:
create a new muc light room.
send/receive text message stanza
queries MAM and receives regular groupchat message. ['6.2.1 Groupchat message from occupant' from above article][Even, here I am getting the muc info but since this is related to a particular muc light room. So, not much useful.]
But I am unable to query MAM and receives an affiliation change notification. See topic [6.2.2 Affiliation change] in the above article link.
Following is the request/response for 'affiliation change notification'
// Request to server with type='set'
<iq type='set'
id='mamget2'
to='muclight.localhost'>
<query xmlns='urn:xmpp:mam:1' queryid='f37'/>
</iq>
// Response from server
<iq xmlns='jabber:client'
from='muclight.localhost'
to='ip0a0g0ur63vdjns#localhost/E42B7412598F3B081543-557985-559692'
id='mamget2'
type='error'>
<error code='' type='cancel'>
<not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>The action is not allowed.</text>
</error>
</iq>
// Request to server with type='get'
<iq type='get'
id='mamget2'
to='muclight.localhost'>
<query xmlns='urn:xmpp:mam:1' queryid='f37'/>
</iq>
// Response from server
<iq xmlns='jabber:client'
from='muclight.localhost'
to='ip0a0g0ur63vdjns#localhost/E42B7412598F3B081543-557985-559692'
id='mamget2'
type='error'>
<error code='' type='cancel'>
<not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>The action is not allowed.</text>
</error>
</iq>
MongooseIM config:
{mod_muc_light, [
{host, "muclight.#HOST#"},
{backend, rdbms},
{max_occupants, 256}
]},
{mod_mam_meta, [
{backend, rdbms},
{no_stanzaid_element, true},
{is_archivable_message, "muclight.#HOST#"},
{pm, false},
{muc, [
{host, "muclight.#HOST#"}
]}
]}
Questions/concerns:
Am I doing something wrong in config? - [I doubt this, because some others operation are working fine like mentioned above]
Am I sending the incorrect IQ stanza - [I doubt this because I am copying the exact same stanza example provided in above link]
Should I update MongooseIM. [May be]
Anything else?
Please help
I got stuck with implementing File Transfer functionality using iOS XMPPFramework(XMPPSiFileTransfer). I have tried out different ways and finally I could sent a file transfer request and the recipient got the request. But even if they accepted nothing seems to tranferring. I tried to sent request to recipients in Spark/Windows machine and iMessage/Mac. In the XMPPSiFileTransfer class itself, I found the developer comment as follow
"It's the other way around when we are the initiator. We send the request by calling initiateFileTransferTo:withData and then wait for the iq result with the si namespace of http://jabber.org/protocol/si, send a disco#info response, open a SOCKS5 socket and then wait for the other side the connect to start the transfer."
When I send a request by calling the method initiateFileTransferTo, SiFileTranfer generates the following XML:
<iq type="set" id="8FF7E518-E518-4A98-B122-914A8345C638" to="rajesh.rajan#chat.speridian.com/Spark 2.6.3" from="sreelash.s#chat.speridian.com/b79f10d5"><si xmlns="http://jabber.org/protocol/si" id="967DAA7A-F159-44D8-AD31-7C532AB459AD" mime-type="image/png" profile="http://jabber.org/protocol/si/profile/file-transfer"><file xmlns="http://jabber.org/protocol/si/profile/file-transfer" name="photoB29D9F41-EC41-41C8-AF6D-EA5E23FF906E.png" size="740"/><feature xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="form"><field var="stream-method" type="list-single"><option><value>http://jabber.org/protocol/bytestreams</value></option></field></x></feature></si></iq>
Then I got the response on didRecieveIq as follows as mentioned in the developer comment.
<iq xmlns="jabber:client" id="8FF7E518-E518-4A98-B122-914A8345C638" to="sreelash.s#chat.speridian.com/b79f10d5" from="rajesh.rajan#chat.speridian.com/Spark 2.6.3" type="result"><si xmlns="http://jabber.org/protocol/si"><feature xmlns="http://jabber.org/protocol/feature-neg"><x xmlns="jabber:x:data" type="submit"><field var="stream-method"><value>http://jabber.org/protocol/bytestreams</value></field></x></feature></si></iq>
When I got the result with si namespace in didRecieveIq, the disco#info is sent as follow
<iq type="get" id="12A7231B-D50A-469E-96B4-BD39278B77EF" to="rajesh.rajan#chat.speridian.com/Spark 2.6.3" from="sreelash.s#chat.speridian.com/b79f10d5"><query xmlns="http://jabber.org/protocol/disco#info"/></iq>
and SOCKS5 socket is tried to open by calling the following method
- (id)initWithStream:(XMPPStream *)stream toJID:(XMPPJID *)aJid sid:(NSString *)sid
But I am getting "SOCKS5 Connection failed!" message. I am not able to identify what's the issue. Can anyone help me to sort out this issue?
Thanks in advance.
you need to make some modifications in the TURNSocket class XEP-0065.
try this xmpp
refer thislink
I want to add iPhone contact in Google contact. I was used Google contact API.but it give me error Content is not allowed in prolog.
i searched this error but not succeeded.
i can authenticate Google through web view and get access-token. After that call API
my request is http://www.google.com/m8/feeds/contacts/default/full?access_token=ya29.1.AADtN_V0YDqLjA7-GmIRZN6Z_yNdfe3z-AmZMx0-ZPPyAvJFsThMaT1E5aF1Qg
please help me regarding this issue.
method type = post
Content type = application/atom+xml;charset=utf-8
Thanks
if you are json
application/atom+json;charset=utf-8
if your xml means try this
$headers = array('Content-Type: application/atom+xml; charset=utf-8',
'Content-Length: '. strlen($xml),
'Authorization: GoogleLogin '. trim($authToken)),
'Connection: close');
For more information:
or
check your xml document tag
<!-- Correct -->
<?xml version="1.0" encoding="utf-8"?>