views:

65

answers:

2

I received a promotional mail from Google AdWords. Because I liked the layout, I thought of giving a look at the HTML source of the mail. When I clicked 'Show original' from the mail options, I saw no HTML code, but a bunch of encoded text.

It was something like this:

--===============0308376380==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: base64

PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNl
dD11dGYtOCIgLz4gDQo8ZGl2IHN0eWxlPSJjb2xvcjojMTExOyBmb250LXNpemU6MTIuOHB4OyBm
b250LWZhbWlseTpBcmlhbCxzYW5zLXNlcmlmOyBsaW5lLWhlaWdodDoxNDAlOyBwYWRkaW5nOjAg
MzBweDsiPiANCiANCgkJPGRpdiBzdHlsZT0iYm9yZGVyLWJvdHRvbTogMXB4IHNvbGlkICM5OTk7
IG92ZXJmbG93OiBoaWRkZW47IG1hcmdpbi10b3A6IDBweDsgbWFyZ2luLWJvdHRvbTogMi40ZW07
Ij4NCjxwIHN0eWxlPSJmb250LXNpemU6MTNweDsgZmxvYXQ6cmlnaHQ7IGNvbG9yOiM2NjY7IG1h
cmdpbjowOyBmb250LXdlaWdodDpib2xkOyI+RW1haWwgMiBvZiA2PC9wPg0KPGltZyBzcmM9Imh0
dHA6Ly93d3cuZ29vZ2xlLmNvbS9hZHdvcmRzL25ld3NsZXR0ZXJzL2ltYWdlcy9sb2dvX2dvb2ds
ZS5naWYiIGFsdD0iR29vZ2xlIiBzdHlsZT0ibWFyZ2luLWJvdHRvbToxcHg7IiAvPg0KPC9kaXY+
DQogDQoJPHAgc3R5bGU9Im1hcmdpbi1ib3R0b206MWVtOyI+SGVsbG8sPC9wPiANCgk8cCBzdHls
ZT0ibWFyZ2luLWJvdHRvbToxZW07Ij5LZXl3b3JkcyBhcmUgdGhlIHNlYXJjaCB0ZXJtcyAod29y
ZHMgb3IgcGhyYXNlcykgd2hpY2ggdHJpZ2dlciB5b3VyIGFkLCBhbmQgdGhleSBhcmUgY3JpdGlj
YWwgdG8gdGhlIHN1Y2Nlc3Mgb2YgeW91ciBBZFdvcmRzIGFkdmVydGlzaW5nLiBUaGlzIGVtYWls
IGV4cGxhaW5zIGhvdyB5b3UgY2FuIGNob29zZSB0aGUgbW9zdCBlZmZlY3RpdmUga2V5d29yZHMs
IGFzc2VzcyB5b3VyIGtleXdvcmQgcGVyZm9ybWFuY2UgYW5kIGhvdyB0aGlzIGFmZmVjdHMgdGhl
IGFtb3VudCB5b3UgcGF5LjwvcD4gDQogDQoJPGgyIHN0eWxlPSJjbGVhcjpib3RoOyBjb2xvcjoj
.........
............
....
.....................
--===============0308376380==--

What's happening here? How the HTML is encoded? Is there a way to decode these stuff? Thanks!

+4  A: 

The HTML is base64 encoded:

Content-Transfer-Encoding: base64

you can decode it using PHP:

echo base64_decode($text);

or online:

http://www.motobit.com/util/base64-decoder-encoder.asp

Pekka
Thank you! Only now I am coming across the base64 encoding. Guess it's time to give it a try in my email applications.
Nirmal
+1 for the link. Nice find!
Christian Payne
A: 

The encoding is base64. There should be modules to convert to and from base64 in almost all programming languages. However, if you are on linux, you can try:

base64 -d
Alan Haggai Alavi
Thank you for the answer!
Nirmal