I'm trying to create a client that can accept a meeting invitation using ActiveSync. I have the meetingresponse over ActiveSync working, but when I send the confirmation email to the organizer and attach the iCalendar formatted reply, it doesn't get parsed out by the server as it should. Instead, it's converted to an attachment and the users attendee status never gets updated.
Here's the MIME email I'm sending:
From: t#xxx.ca
To: Tester Testing <test#xxx.ca>
Message-ID: <i8swl8yv.-4t2#-1387408011.xxx.ca>
Subject: Accepted: Test 11:36 Wed
MIME-Version: 1.0
Content-Type: multipart/alternative;
boundary="----=_Part_0_1114661696.1429717004439"
------=_Part_0_1114661696.1429717004439
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
these are forced comments
------=_Part_0_1114661696.1429717004439
Content-Type: text/calendar; method=REPLY; charset=utf-8; name=meeting.ics
Content-Transfer-Encoding: quoted-printable
BEGIN:VCALENDAR
METHOD:REPLY
PRODID:XXXEmail
VERSION:2.0
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED:MAILTO:t#xxx.ca
ORGANIZER:MAILTO:test#xxx.ca
DTSTART:20150422T120000
DTEND:20150422T123000
DTSTAMP:20150422T113625
LOCATION;LANGUAGE=en-US:here
UID:3D6D7B89-DE7E-45A1-B916-19DEDB2B1ADC
CLASS:PUBLIC
STATUS:CONFIRMED
TRANSP:OPAQUE
PRIORITY:5
SEQUENCE:0
END:VEVENT
END:VCALENDAR
------=_Part_0_1114661696.1429717004439--
Does anyone see an issue with the iCalendar Reply? Or how the mime is formatted? Or any ideas why this won't work?
EDIT:
As requested, here's an example MIME email that was correctly parsed on the server:
Content-Type: multipart/alternative; boundary="===============0124021817=="
X-Client-ID: 57
X-Mailer: BlackBerry Email (10.3.1.2576)
Message-ID: <20150422140519.5439570.43618.57#xxx.ca>
Date: Wed, 22 Apr 2015 10:05:19 -0400
Subject: Accepted: test at 10:04 Wed
From: <t#xxx.ca>
To: <test#xxx.ca>
MIME-Version: 1.0
--===============0124021817==
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Commment
--===============0124021817==
Content-Type: text/calendar; charset="utf-8"; name="meeting.ics"; method=REPLY
Content-Transfer-Encoding: quoted-printable
BEGIN:VCALENDAR
PRODID:-//Research In Motion//RIM App//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REPLY
BEGIN:VTIMEZONE
TZID:America/New_York
BEGIN:STANDARD
DTSTART:20071104T020000
RRULE:FREQ=3DYEARLY;BYDAY=3D1SU;BYMONTH=3D11
TZNAME:EST
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:20070311T020000
RRULE:FREQ=3DYEARLY;BYDAY=3D2SU;BYMONTH=3D3
TZNAME:EDT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
ATTENDEE;RSVP=3DTRUE;ROLE=3DREQ-PARTICIPANT;CN=3DTest Test;PARTSTAT=3DACCE=
PTED:mailto:
t#xxx.ca
COMMENT:Commment
CREATED:20150422T140505Z
DTEND;TZID=3DAmerica/New_York:20150422T110000
DTSTAMP:20150422T140518Z
DTSTART;TZID=3DAmerica/New_York:20150422T103000
LOCATION:here
ORGANIZER;CN=3DTesting Tester:mailto:test#xxx.ca
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:test at 10:04 Wed
TRANSP:OPAQUE
UID:A885C120-ABAD-4418-AB24-8B93E57194F0
BEGIN:VALARM
ACTION:DISPLAY
DESCRIPTION:test at 10:04 Wed in 15 minutes.
TRIGGER;RELATED=3DSTART:-PT15M
X-WR-ALARMUID:9b758290-e8f8-11e4-afff-b57e838ad0c3
END:VALARM
END:VEVENT
END:VCALENDAR
--===============0124021817==--
I've tried including the timezone information and it still didn't work. I have another email program that also accepts meeting invites properly, and my iCalendar attachment is basically identical to theirs (they base64 encode the iCalendar attachment which I've also tried with no luck).
When using a different MIME writer (this one came from Android open source project), the vCalendar content I'm sending it interpreted and parsed correctly. I can't see any differences in the MIME format though (besides it being Base64 encoded which I tried and didn't work)...?
Date: Mon, 27 Apr 2015 14:22:43 -0400
Subject: Accepted: test event Monday 2:22
Message-ID: <i907pyoo.17vp#-1387408011.xxx.ca>
From: t#xxx.ca
To: "Tester Testing" <test#xxx.ca>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary=" _com.android.email_7881218929099440"
----_com.android.email_7881218929099440
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: base64
----_com.android.email_7881218929099440
Content-Type: text/calendar;
name="meeting.ics"
Content-Transfer-Encoding: base64
QkVHSU46VkNBTEVOREFSDQpNRVRIT0Q6UkVQTFkNClBST0RJRDpYWFhFbWFpbA0KVkVSU0lPTjoyLjANCkJFR0lOOlZFVkVOVA0KVUlEOkFGQzMyNURELTk1MjYtNENFRS05MTlBLUI4RkIxQzU1RTBCQw0KQVRURU5ERUU7UEFSVFNUQVQ9QUNDRVBURUQ6TUFJTFRPOnRAeHh4LmNhDQpPUkdBTklaRVI6TUFJTFRPOnRlc3RAeHh4LmNhDQpEVFNUQVJUOjIwMTUwNDI3VDE0MzAwMA0KRFRFTkQ6MjAxNTA0MjdUMTUwMDAwDQpEVFNUQU1QOjIwMTUwNDI3VDE0MjIzMQ0KTE9DQVRJT047TEFOR1VBR0U9ZW4tVVM6aGVyZQ0KQ0xBU1M6UFVCTElDDQpTVEFUVVM6Q09ORklSTUVEDQpUUkFOU1A6T1BBUVVFDQpQUklPUklUWTo1DQpTRVFVRU5DRTowDQpFTkQ6VkVWRU5UDQpFTkQ6VkNBTEVOREFS
----_com.android.email_7881218929099440--
Try using multipart/mixed instead of multipart/alternative.
Related
Using certbot fails to generate certificate with this error:
org.shredzone.acme4j.exception.AcmeException: Failed to pass the challenge for domain www.
mysampledomain123.com, ... Giving up.
I manually checked the challenge file and got
http://www.mysampledomain123.com/.well-known/acme-challenge/jU--PkDrn5tDZw2RN6NNJHbPD00ovHFkLFvN3mJdeQX
Inside the file:
jU--PkDrn5tDZw2RN6NNJHbPD00ovHFkLFvN3mJdeQX.tuMr-UijwpsJ1KVZkdWTYgodWZ2SxxKdB7_CMAAEfpg
And here's the complete HTTP response header:
Accept-Ranges: bytes
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/plain;charset=iso-8859-1
Date: Sun, 16 Feb 2020 14:15:22 GMT
Server: nginx/1.14.0 (Ubuntu)
Transfer-Encoding: chunked
Vary: Accept-Charset, Accept-Encoding, Accept-Language, Accept
X-Powered-By: MyServer
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 0
I'm wondering whether the problem is with the HTTP response headers or the content itself.
Any ideas would be appreciated.
I am a new programmer i am trying to build an app with Json.
If i use this URL doesn't work . http://zsuzsafodraszat.hostzi.com/boltok.json
if i Use this, my app working. https://api.myjson.com/bins/3zm8i
Both Json files exactly the same.
Can you help me what i am doing wrong ? Maybe bad extension or web000 is not a good service for Json ? Can you give me some good free json hosting ? Thanks
Those 2 urls do not have the same content or the same headers. You can see this if run curl commands from the command line:
$ curl -i "http://zsuzsafodraszat.hostzi.com/boltok.json"
HTTP/1.1 200 OK
Date: Wed, 13 Apr 2016 22:52:50 GMT
Server: Apache
Last-Modified: Wed, 13 Apr 2016 16:48:23 GMT
Accept-Ranges: bytes
Content-Length: 1020
Connection: close
Content-Type: application/json
??{"Aldi":"http://catalog.aldi.com/emag/hu_HU/print/Online_katalogus_04_07/Online_katalogus_04_07.pdf",
"Lidl":"http://www.lidl.hu/statics/lidl-hu/ds_doc/HU_HHZ_kw14_2016.pdf",
"Spar":"http://ajanlatok.spar.hu/view/download/?d=1279",
"Penny":"https://view.publitas.com/16538/136265/pdfs/016f82fb5b00bc97b5a8c35f512d89b01cd3e3ce.pdf",
"Coop":"https://view.publitas.com/2556/133497/pdfs/16603d7e9bf30e8a8a4efec7f01d3fa2caf92fe0.pdf",
"Auchan":"http://www.lidl.hu/statics/lidl-hu/ds_doc/HU_HHZ_kw14_2016.pdf"}
$ curl -i "https://api.myjson.com/bins/3zm8i"
HTTP/1.1 200 OK
Server: nginx/1.5.8
Date: Wed, 13 Apr 2016 22:52:56 GMT
Content-Type: application/json
Content-Length: 500
Connection: keep-alive
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
{"Aldi":"http://catalog.aldi.com/emag/hu_HU/print/Online_katalogus_04_07/Online_katalogus_04_07.pdf","Lidl":"http://www.lidl.hu/statics/lidl-hu/ds_doc/HU_HHZ_kw14_2016.pdf","Spar":"http://ajanlatok.spar.hu/view/download/?id=1279","Penny":"https://view.publitas.com/16538/136265/pdfs/016f82fb5b00bc97b5a8c35f512d89b01cd3e3ce.pdf","Coop":"https://view.publitas.com/2556/133497/pdfs/16603d7e9bf30e8a8a4efec7f01d3fa2caf92fe0.pdf","Auchan":"http://www.lidl.hu/statics/lidl-hu/ds_doc/HU_HHZ_kw14_2016.pdf"}
As you can see, one of them has a couple of junk bytes at the beginning that my terminal is displaying as question marks. Also the http headers are different. The Content-Lengths are wildly different too. Did you use something other than a plain text editor to create the json payload in the failing example?
Try removing the junk characters and adding these http headers:
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
I've got this URL (http://vignette4.wikia.nocookie.net/fantendo/images/6/6e/Small-mario.png/revision/latest?cb=20120718024112)
how determinate the file extension if it isn't at the end of the url?
You'll need to read the response headers. The MIME Type if known is stored in the Content-Type header.
HTTP/1.1 200 OK
Content-Disposition: inline; filename="Small-mario.png"
X-Thumbnailer: Vignette
Content-Type: image/png
Cache-Control: public, max-age=31536000
X-Surrogate-Key: ad1f82ba0cbe38fa60f83c036993a71e05dae492
Server: Jetty(9.2.z-SNAPSHOT)
X-Cacheable: YES
Content-Length: 58457
Accept-Ranges: bytes
Date: Mon, 06 Jul 2015 16:12:31 GMT
Age: 65
Connection: keep-alive
X-Served-By: thumbnailer-s1, cache-wk-sjc3160-WIKIA, cache-lhr6322-LHR
X-Cache: ORIGIN, MISS, HIT
X-Cache-Hits: ORIGIN, 0, 5
X-Timer: S1436199151.564330,VS0,VE0
Vary: Accept-Encoding
Timing-Allow-Origin: *
You're looking for the Content-Type header, which the server ought to send in the HTTP response to tell you this.
Note that it is not guaranteed to be accurate, or present at all.
I tried until now to create an object of type MimeMessage using JavaMail api, and after that to obtain its raw representation, but with no success. The only thing that I could obtain is a raw representation of the content of the email, but the header, subject, or recipients were not included. I am interested in any suggestions, any java libraries, that could help me in creating an email object, and after that obtain its raw representation. The raw representation should look something like this:
received: from imta14.emeryville.ca.mail.myisp.net ([nn.nn.30.46])
by alnrmxc19.isp.net (alnrmxc19) with ESMTP
id <20080930215116a19007q9u6e>; Tue, 30 Sep 2008 21:51:16 +0000
X-Originating-IP: [nn.nn.30.46]
Received: from libertatea.go ([nn.nn.161.160])
by IMTA14.mail.isp.net with isp
id M9qy1a00V3TwUto0E9rELB; Tue, 30 Sep 2008 21:51:15 +0000
X-Authority-Analysis: v=1.0 c=1 a=DZlucjOqAY8A:10 a=mnGO974OAAAA:8
a=9MJFf195B83LjESASTQA:9 a=Lm7NQ261g8eJHgoaELoA:7
a=7Narey355jFQWZRww2lj1r9-lCkA:4 a=8COHQAuY8ZYA:10 a=zEVpGHA-kecA:10
a=37WNUvjkh6kA:10
Received: by libertatea.go id hm1nfa0di0sn for <xxx#myisp.net>; Sun,30 Sep 2018 09:36:35
+0300 (envelope-from <Hometown.Quotes_ary#mousemegadot.com>)
Message-ID: <79864795#mousemegadot.com>
Date: Sun, 30 Sep 2018 09:36:35 +0300
From: "Hometown Quotes" <Hometown.Quotes_ary#mousemegadot.com>
To: dummy#myisp.net
Subject: Find Affordable Auto Insurance Today
MIME-Version: 1.0
X-UID: 79864795.modhnrfo.jhhnk.1
Content-Type: multipart/alternative; boundary="0-1411506895-1200484069=:66653"
Content-Transfer-Encoding: 8bit
X-PMFLAGS: 570966272 9 1 PE71PYHD.CNM
X-UC-Weight: [# ] 51
X-CC-Diagnostic: Test 'LazyHTML Tolerant' (51)
--0-1411506895-1200484069=:66653
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
--0-1411506895-1200484069=:66653
Content-transfer-encoding: 8bit
Content-Type: text/html; charset=iso-8859-1; DelSp="Yes"; format="flowed"
What you are looking for is MimeMessag#writeTo which outputs the message as an RFC 822 format stream.
An example of using writeTo to convert a MimeMessage to a String.
MimeMessage mimeMessage;
// mimeMessage get assigned
ByteArrayOutputStream output = new ByteArrayOutputStream();
mimeMessage.writeTo(output);
String rawEmail = output.toString();
I am trying to download an image from URL. I use the Apache Commons library:
org.apache.commons.io.FileUtils
.copyURLToFile(
new URL(
"https://lh3.ggpht.com/AXYMUV5cpne2vE9U3X8x87HgrbwijwiG50_yOnehU2MUPKDoJky-BKFOPZzZ07Pug8U=h230"),
new File("test.png"));
While opening the image it says not an PNG file. Is this a good way to download images from url to local?
Updated .
Thankyou guys for your answers i undestand that i need to get the connection.getContentType(); and then save it as jpg or png as it is.
if you check the url, It is JPEG file. Try to execute program after renaming file name to test.jpeg..
Checking for the content type see this SO Question.
Then use this to save the file to the right type.
Running wget on this URL and looking at the HTTP response, looks like the file type is explicitly specified as JPEG:
--2012-06-27 16:55:30-- https://lh3.ggpht.com/AXYMUV5cpne2vE9U3X8x87HgrbwijwiG50_yOnehU2MUPKDoJky-BKFOPZzZ07Pug8U=h230
Resolving lh3.ggpht.com... 74.125.237.108, 74.125.237.106, 74.125.237.107, ...
Connecting to lh3.ggpht.com|74.125.237.108|:443... connected.
HTTP request sent, awaiting response...
HTTP/1.0 200 OK
Access-Control-Allow-Origin: *
ETag: "v1"
Expires: Thu, 28 Jun 2012 06:50:40 GMT
Content-Disposition: inline;filename="unnamed.jpg"
Content-Type: image/jpeg
X-Content-Type-Options: nosniff
Date: Wed, 27 Jun 2012 06:50:40 GMT
Server: fife
Content-Length: 46597
X-XSS-Protection: 1; mode=block
Cache-Control: public, max-age=86400, no-transform
Age: 290
Connection: Keep-Alive
Length: 46597 (46K) [image/jpeg]