Answer the question
In order to leave comments, you need to log in
How and how to parse email - format?
Hello!
I get imap mail from Yandex, i.e. from your Yandex mailbox. Some letters come in an interesting way for me in this format:
----ALT--3qTFCBd0ekkfmpv0s6C69hoX0USbWYVW1512581220
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64
CgoK
----ALT--3qTFCBd0ekkfmpv0s6C69hoX0USbWYVW1512581220
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: base64
CjxIVE1MPjxCT0RZPjxicj48YnI+PGJyPjwvQk9EWT48L0hUTUw+Cg==
----ALT--3qTFCBd0ekkfmpv0s6C69hoX0USbWYVW1512581220--
How can this be decoded?
I am using imap parsing function.
switch ((int)$encoding) {
# 7BIT
case 0:
$body = $msg_body;
break;
# 8BIT
case 1:
$body = imap_8bit($msg_body);
break;
# BINARY
case 2:
$body = imap_binary($msg_body);
break;
# BASE64
case 3:
$body = imap_base64($msg_body);
break;
# QUOTED-PRINTABLE
case 4:
$body = imap_qprint($msg_body);
break;
# OTHER
case 5:
$body = $msg_body;
break;
# UNKNOWN
default:
$body = $msg_body;
break;
}
return $body;
$structure = imap_fetchstructure($connection, $num);
$msg = imap_fetchbody($connection, $num, 1, FT_PEEK);
Answer the question
In order to leave comments, you need to log in
Not an expert, but perhaps this line is a clue
this is base64, it says here
The rest is some kind of garbage, maybe some keys or a crooked encoding, not a big specialist in letters.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question