Java POP3 message parser without JavaMail API - java

Is there any available email parser library or implementation tutorial (without JavaMail API) to parse messages of the fallowing format to get their fields such as FROM / SUBJECT /etc ?
I want to parse a text file of these messages received via the POP3 protocol in my application and finally display them in a html file.
a sample message is :
-------------------- messsage 1, size=4234 --------------------
Return-path: <yyy#gmail.com>
Received: from mail-iy0-f171.google.com (mail-iy0-f171.google.com [209.85.210.171])
by xxxmail.com (xxxmail.com)
(MDaemon PRO v11.0.0)
with ESMTP id md50000000053.msg
for <xx#xxxmail.com>; Mon, 12 Dec 2011 22:55:39 +0330
Authentication-Results: xxxmail.com
spf=pass smtp.mail=haghighi.fa#gmail.com;
x-ip-ptr=pass dns.ptr=mail-iy0-f171.google.com (ip=x.x.x.x);
x-ip-helo=pass smtp.helo=mail-iy0-f171.google.com (ip=x.x.x.x);
x-ip-mail=hardfail smtp.mail=haghighi.fa#gmail.com (does not match x.x.x.x);
x-vbr=hardfail header.vbr-info=gmail.com (domain not recognized);
dkim=pass header.d=gmail.com (b=Cv+42gRZMW; 1:0:good);
Received-SPF: pass (xxxmail.com: domain of yyy#gmail.com
designates x.x.x.x as permitted sender)
x-spf-client=MDaemon.PRO.v11.0.0
receiver=xxxmail.com
client-ip=x.x.x.x
envelope-from=<yyy#gmail.com>
helo=mail-iy0-f171.google.com
X-Spam-Processed: xxxmail.com, Mon, 12 Dec 2011 22:55:39 +0330
(not processed: sender in recipient's private address book)
X-MDPtrLookup-Result: pass dns.ptr=mail-iy0-f171.google.com (ip=x.x.x.x) (xxxmail.com)
X-MDHeloLookup-Result: pass smtp.helo=mail-iy0-f171.google.com (ip=x.x.x.x) (xxxmail.com)
X-MDMailLookup-Result: hardfail smtp.mail=yyy#gmail.com (does not match x.x.x.x) (xxxmail.com)
X-MDDKIM-Result: unapproved (xxxmail.com)
X-MDVBR-Result: not certified (xxxmail.com)
X-MDSPF-Result: unapproved (xxxmail.com)
X-Rcpt-To: xxx#xxxmail.com
X-MDRcpt-To: xxx#xxxmail.com
X-MDRemoteIP: x.x.x.x
X-Return-Path: yyy#gmail.com
X-Envelope-From: yyya#gmail.com
X-MDaemon-Deliver-To: xxx#xxxmail.com
Received: by iaen33 with SMTP id n33so35124825iae.30
for <xxx#xxxmail.com>; Mon, 12 Dec 2011 11:28:52 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;
h=mime-version:in-reply-to:references:date:message-id:subject:from:to
:content-type;
bh=SZ4ok7NaD3MuwvPJVzJAtsCaqSMeAJJ6Kq3AFI1elK8=;
b=Cv+42gRZMW8gRSzCX11ToY/EnHTqzO2E5cWkJsnwj6JCapz5GXG2iIadjBkHyKuGkE
i5cjPQyZXhHBg9ZfKRaWViSMqiaySvak7WA+yVf65JB2zEHykysFHbqbfPLG2CaRxXHi
PVfJVURd5MHCLpSyCxeW25slIBOBqpWabuWj4=
MIME-Version: 1.0
Received: by 10.42.151.68 with SMTP id d4mr13014719icw.36.1323718132412; Mon,
12 Dec 2011 11:28:52 -0800 (PST)
Received: by 10.43.49.67 with HTTP; Mon, 12 Dec 2011 11:28:52 -0800 (PST)
In-Reply-To: <4ee65516.85310e0a.43bf.238fSMTPIN_ADDED#mx.google.com>
References: <4ee65516.85310e0a.43bf.238fSMTPIN_ADDED#mx.google.com>
Date: Mon, 12 Dec 2011 11:28:52 -0800
Message-ID: <CAPGX6DbXDV-wFmbMcaw1rQVvrZGbBOnqPpJSNkwuhbrBFa=TRQ#mail.gmail.com>
Subject: Re: Hi :D
From: y y <yyy#gmail.com>
To: xxx#xxxmail.com
Content-Type: multipart/alternative; boundary=90e6ba6e872e10b18504b3ea252a
X-Antivirus: avast! (VPS 111228-0, 12/28/2011), Inbound message
X-Antivirus-Status: Clean
--90e6ba6e872e10b18504b3ea252a
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
=D8=A7=D9=84=D9=84=D9=87 =D9=88=D8=A7=D9=82=D8=B9=D9=86 =D8=A7=DA=A9=D8=A8=
=D8=B1=D9=87 :=D8=AF=DB=8C
On Mon, Dec 12, 2011 at 12:00 AM, <xxx#xxxmail.com> wrote:
> Hi! this is the main text of the message :)
>
>
>

I've found these examples for both POP3 and SMTP:
http://inetjava.sourceforge.net/lectures/part1_sockets/InetJava-1.8-Email-Examples.html
They don't rely on Java Mail, they use just a plain socket. Look at getMessageHeaders() to obtain the information about the fields FROM and SUBJECT.

Related

Javax Mail Session, Apache Commons Mail And Postfix Send As Spam

Development Environment:
Ubuntu 14.0.4
Java 8 oracle
javax.mail | mail | 1.4.7
org.apache.commons | commons-email | 1.4
If I send email through terminal like:
mail tahubulatbandung#gmail.com
The email is coming to INBOX with original (in gmail):
Delivered-To: tahubulatbandung#gmail.com
Received: by 10.129.51.141 with SMTP id z135csp156716ywz;
Thu, 9 Jun 2016 00:26:03 -0700 (PDT)
X-Received: by 10.13.223.135 with SMTP id
i129mr4894376ywe.144.1465457163676;
Thu, 09 Jun 2016 00:26:03 -0700 (PDT)
Return-Path:
Received: from clickspayment.com ([31.220.107.128])
by mx.google.com with ESMTPS id h1si1253884ywc.22.2016.06.09.00.26.03
for
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 09 Jun 2016 00:26:03 -0700 (PDT)
Received-SPF: softfail (google.com: domain of transitioning
root#clickspayment.com does not designate 31.220.107.128 as permitted
sender) client-ip=31.220.107.128;
Authentication-Results: mx.google.com;
dkim=temperror (no key for signature) header.i=#clickspayment.com;
spf=softfail (google.com: domain of transitioning root#clickspayment.com does not designate 31.220.107.128 as permitted
sender) smtp.mailfrom=root#clickspayment.com
Received: by clickspayment.com (Postfix, from userid 0) id
748083C1387; Thu, 9 Jun 2016 03:26:03 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=clickspayment.com; s=mail; t=1465457163;
bh=Ck5SoRNWUpSR4X0COv7R5ub2pUTtl6xz4dTFz++ji4M=;
h=To:Subject:Date:From;
b=mNu86iHLxiV4fCP4msTOwsf6/fX9u/6NaQZ++A6kJv/OHMPhyK0FnT3+MDH/tY6VT
g6WTzaTbt1DD4mF2N52Jb+5Ht/3v76U/TcpuQ7pLldrdu0z1JwAwuPd8CiZzW87WbW
r5zOsuvTi4NJ5DDzG5Ds+yJxVNmq7sViIkYS7XXQ=
To: tahubulatbandung#gmail.com
Subject: test
Message-Id: <20160609072603.748083C1387#clickspayment.com>
Date: Thu, 9 Jun 2016 03:26:03 -0400 (EDT)
From: root#clickspayment.com (root)
And mail.log:
Jun 9 03:26:03 clickspayment postfix/pickup[2178]: 748083C1387: uid=0
from=
Jun 9 03:26:03 clickspayment postfix/cleanup[2404]: 748083C1387:
message-id=<20160609072603.748083C1387#clickspayment.com>
Jun 9 03:26:03 clickspayment postfix/qmgr[1407]: 748083C1387:
from=, size=347, nrcpt=1 (queue active)
Jun 9 03:26:03 clickspayment postfix/smtp[2405]: 748083C1387:
to=,
relay=gmail-smtp-in.l.google.com[64.233.176.27]:25, delay=0.21,
delays=0.05/0.01/0.1/0.05, dsn=2.0.0, status=sent (250 2.0.0 OK
1465457163 h1si1253884ywc.22 - gsmtp)
Jun 9 03:26:03 clickspayment postfix/qmgr[1407]: 748083C1387: removed
But if I send use javax.mail.Session and org.apache.commons.Email, the email is coming to SPAM with original email:
Delivered-To: tahubulatbandung#gmail.com
Received: by 10.129.51.141 with SMTP id z135csp156186ywz;
Thu, 9 Jun 2016 00:24:20 -0700 (PDT)
X-Received: by 10.129.74.86 with SMTP id
x83mr5608016ywa.38.1465457060965;
Thu, 09 Jun 2016 00:24:20 -0700 (PDT)
Return-Path:
Received: from clickspayment.com ([31.220.107.128])
by mx.google.com with ESMTPS id l5si1247871ywg.127.2016.06.09.00.24.20
for
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Thu, 09 Jun 2016 00:24:20 -0700 (PDT)
Received-SPF: softfail (google.com: domain of transitioning
root#clickspayment.com does not designate 31.220.107.128 as permitted
sender) client-ip=31.220.107.128;
Authentication-Results: mx.google.com;
dkim=temperror (no key for signature) header.i=#clickspayment.com;
spf=softfail (google.com: domain of transitioning root#clickspayment.com does not designate 31.220.107.128 as permitted
sender) smtp.mailfrom=root#clickspayment.com
Received: from clickspayment.com (localhost.localdomain [127.0.0.1])
by clickspayment.com (Postfix) with ESMTP id 949713C1386 for
; Thu, 9 Jun 2016 03:24:20 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=clickspayment.com; s=mail; t=1465457060;
bh=qEMHl+hG2/ELzab8NTCEbnlZd7Z1lat3lNrCpGce/bk=;
h=Date:From:To:Subject;
b=CHOUvAP669p40iNUdnoKhOKbVHLi1NMYQ3AnJ1p4aNZL4pFP+dJKj1qFa4g4U5Rm9
V/eJPUXUy6cmnuMxn66nd1Vx6sEtT3nStYqk93XL3D0f4ru681d+hpjPjXgSnecE3z
aG+XWUCu8owaF3wp9Tn8BzjgXLkj22yX32p4Q8Ag=
Date: Thu, 9 Jun 2016 03:24:20 -0400 (EDT)
From: Clicks Payment
To: Tahu Bulat Bandung
Message-ID: <1482652801.13.1465457060576.JavaMail.root#clickspayment>
Subject: Selamat bergabung Tahu Bulat Bandung di Clicks Payment
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_12_76930216.1465457060575"
------=_Part_12_76930216.1465457060575
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
and mail.log:
Jun 9 03:24:20 clickspayment postfix/smtpd[2340]: connect from
localhost.localdomain[127.0.0.1]
Jun 9 03:24:20 clickspayment postfix/smtpd[2340]: 949713C1386:
client=localhost.localdomain[127.0.0.1]
Jun 9 03:24:20 clickspayment postfix/cleanup[2345]: 949713C1386:
message-id=<1482652801.13.1465457060576.JavaMail.root#clickspayment>
Jun 9 03:24:20 clickspayment postfix/qmgr[1407]: 949713C1386:
from=, size=1208, nrcpt=1 (queue active)
Jun 9 03:24:20 clickspayment postfix/smtpd[2340]: disconnect from
localhost.localdomain[127.0.0.1]
Jun 9 03:24:20 clickspayment postfix/smtpd[2340]: connect from
localhost.localdomain[127.0.0.1]
Jun 9 03:24:20 clickspayment postfix/smtpd[2340]: A0CAE3C1387:
client=localhost.localdomain[127.0.0.1]
Jun 9 03:24:20 clickspayment postfix/cleanup[2345]: A0CAE3C1387:
message-id=<2025713591.15.1465457060656.JavaMail.root#clickspayment>
Jun 9 03:24:20 clickspayment postfix/qmgr[1407]: A0CAE3C1387:
from=, size=1037, nrcpt=1 (queue active)
Jun 9 03:24:20 clickspayment postfix/smtpd[2340]: disconnect from
localhost.localdomain[127.0.0.1]
Jun 9 03:24:20 clickspayment postfix/smtp[2346]: 949713C1386:
to=,
relay=gmail-smtp-in.l.google.com[64.233.176.27]:25, delay=0.37,
delays=0.05/0.01/0.07/0.24, dsn=2.0.0, status=sent (250 2.0.0 OK
1465457060 l5si1247871ywg.127 - gsmtp)
Jun 9 03:24:20 clickspayment postfix/qmgr[1407]: 949713C1386: removed
Jun 9 03:24:22 clickspayment postfix/smtp[2347]: A0CAE3C1387:
to=,
relay=mta6.am0.yahoodns.net[98.136.216.25]:25, delay=2.1,
delays=0.04/0.01/0.5/1.5, dsn=2.0.0, status=sent (250 ok dirdel)
Jun 9 03:24:22 clickspayment postfix/qmgr[1407]: A0CAE3C1387: removed
All of original email:
Delivered-To: tahubulatbandung#gmail.com
Received: by 10.129.51.141 with SMTP id z135csp102207ywz;
Fri, 10 Jun 2016 01:00:37 -0700 (PDT)
X-Received: by 10.37.193.194 with SMTP id
r185mr267300ybf.134.1465545637684;
Fri, 10 Jun 2016 01:00:37 -0700 (PDT)
Return-Path:
Received: from clickspayment.com ([31.220.107.128])
by mx.google.com with ESMTPS id i15si523000ywc.107.2016.06.10.01.00.37
for
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Fri, 10 Jun 2016 01:00:37 -0700 (PDT)
Received-SPF: softfail (google.com: domain of transitioning
root#clickspayment.com does not designate 31.220.107.128 as permitted
sender) client-ip=31.220.107.128;
Authentication-Results: mx.google.com;
dkim=temperror (no key for signature) header.i=#clickspayment.com;
spf=softfail (google.com: domain of transitioning root#clickspayment.com does not designate 31.220.107.128 as permitted
sender) smtp.mailfrom=root#clickspayment.com
Received: from clickspayment.com (localhost.localdomain [127.0.0.1])
by clickspayment.com (Postfix) with ESMTP id 312873C13C3 for
; Fri, 10 Jun 2016 04:00:37 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=clickspayment.com; s=mail; t=1465545637;
bh=pE0DkDEfJeuwh6Y4b12fsUQrMeqvh1RXyn3pGeU9lbY=;
h=Date:From:To:Subject;
b=qOhNNajIwDPfHKyUyVPmYtZqc7MSu3cjejpERcwUbzZa5aHRThuNGTTgcLsM7mAKE
TKf4KA+drC1Xkd94cZUiiMZ91bmr1Kd9bUKgOyZQTj1kvGycHiEAguJgq7jJ5vNfYT
HAEY7Kp4giVKDYBxnDRdcbUtnErmzPa8HtMQnsIE=
Date: Fri, 10 Jun 2016 04:00:37 -0400 (EDT)
From: Clicks Payment
To: tahubulatbandung
Message-ID: <1229938465.1.1465545637134.JavaMail.root#clickspayment>
Subject: Selamat bergabung tahubulatbandung di Clicks Payment
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_0_237960750.1465545637084"
------=_Part_0_237960750.1465545637084
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<p> Hai tahubulatbandung... <br/> Terimakasih sudah bersedia bergabung dengan kami di Clicks Payment. <br/> Kode verifikasi: <code>XXXX</code> <br/> Silahkan verifikasi akun Anda disini <br/> <br/> <br/> Sincerely, <br/> Clicks Payment Team <br/> https://www.clickspayment.com/ </p>
------=_Part_0_237960750.1465545637084--
After I added SPF - Pass and simple email use mail in terimal, I got the original email like this and it is in SPAM T.T:
Delivered-To: rudi.mail90#gmail.com
Received: by 10.13.209.130 with SMTP id t124csp158132ywd;
Fri, 10 Jun 2016 03:02:55 -0700 (PDT)
X-Received: by 10.129.73.18 with SMTP id
w18mr557700ywa.176.1465552975076;
Fri, 10 Jun 2016 03:02:55 -0700 (PDT)
Return-Path:
Received: from clickspayment.com ([31.220.107.128])
by mx.google.com with ESMTPS id z82si2376857ywz.355.2016.06.10.03.02.55
for
(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
Fri, 10 Jun 2016 03:02:55 -0700 (PDT)
Received-SPF: pass (google.com: domain of root#clickspayment.com
designates 31.220.107.128 as permitted sender)
client-ip=31.220.107.128;
Authentication-Results: mx.google.com;
dkim=temperror (no key for signature) header.i=#clickspayment.com;
spf=pass (google.com: domain of root#clickspayment.com designates 31.220.107.128 as permitted sender)
smtp.mailfrom=root#clickspayment.com
Received: by clickspayment.com (Postfix, from userid 0) id
D65993C13C5; Fri, 10 Jun 2016 06:02:54 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=clickspayment.com; s=mail; t=1465552974;
bh=4uXyTgHBr7HkMrUJTAkZhWiC4S4lwgKuOxnShvQDBn4=;
h=To:Subject:Date:From;
b=HLX5O5JBtLlLC8TJeq6aG1W+VQqoTJK2e6P0YAX3iTmTp7ZibxLc3TCnUPyv/66zf
ghtya2vvRSaxywrQR4scfXboOfjuWE6P/sFSbbD5DJjCWER0UCBr/bEDAt7RsBoIV/
R+y7VSeltEdAvfEbb1acobdrNhTn7zO/MdT46cFI=
To: rudi.mail90#gmail.com
Subject: tttttt
Message-Id: <20160610100254.D65993C13C5#clickspayment.com>
Date: Fri, 10 Jun 2016 06:02:54 -0400 (EDT)
From: root#clickspayment.com (root)
tttttttttttt
After I configured 3 points:
Received-SPF: pass (google.com: domain of root#clickspayment.com designates 31.220.107.128 as permitted sender) client-ip=31.220.107.128;
Authentication-Results: mx.google.com;
dkim=pass header.i=#clickspayment.com;
spf=pass (google.com: domain of root#clickspayment.com designates 31.220.107.128 as permitted sender) smtp.mailfrom=root#clickspayment.com
Received: from clickspayment.com (clickspayment.com [31.220.107.128])
by clickspayment.com (Postfix) with ESMTPA id 48BCE3C13E4
for ; Sat, 11 Jun 2016 22:53:36 -0400 (EDT) --> I am not sure for localhost.localdomain. After I tested for
Received: from clickspayment.com (localhost.localdomain [127.0.0.1])
by clickspayment.com (Postfix) with ESMTP id 2686A3C13EB
for ; Mon, 13 Jun 2016 01:00:07 -0400 (EDT), the email is coming to INBOX
the email is coming in INBOX Gmail and the icon is not "?" anymore..
the email is coming in INBOX Yahoo
BUT, other problem is appear in HOTMAIL T.T, the email is coming to EMAIL JUNK, the source:
Received: from HK2PR0401MB1265.apcprd04.prod.outlook.com
(10.165.179.143) by PS1PR0401MB1273.apcprd04.prod.outlook.com
(10.165.67.148) with Microsoft SMTP Server (TLS) id 15.1.511.8 via
Mailbox Transport; Sun, 12 Jun 2016 10:13:19 +0000
Received: from PS1PR0401CA0037.apcprd04.prod.outlook.com
(10.169.107.175) by HK2PR0401MB1265.apcprd04.prod.outlook.com
(10.165.179.143) with Microsoft SMTP Server (TLS) id 15.1.517.8; Sun,
12 Jun 2016 10:13:18 +0000
Received: from HK2APC01FT115.eop-APC01.prod.protection.outlook.com
(2a01:111:f400:7ebc::202) by PS1PR0401CA0037.outlook.office365.com
(2a01:111:e400:7a06::47) with Microsoft SMTP Server (TLS) id
15.1.517.8 via Frontend Transport; Sun, 12 Jun 2016 10:13:18 +0000
Received: from COL004-MC5F18.hotmail.com (10.152.248.56) by
HK2APC01FT115.mail.protection.outlook.com (10.152.248.194) with
Microsoft SMTP Server (TLS) id 15.1.497.8 via Frontend Transport;
Sun, 12 Jun 2016 10:13:16 +0000
Received: from clickspayment.com ([31.220.107.128]) by
COL004-MC5F18.hotmail.com over TLS secured channel with Microsoft
SMTPSVC(7.5.7601.23143); Sun, 12 Jun 2016 03:13:12 -0700
Received: from clickspayment.com (clickspayment.com [31.220.107.128])
by clickspayment.com (Postfix) with ESMTPA id 277F73C13E5 for
; Sun, 12 Jun 2016 06:13:12 -0400 (EDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=clickspayment.com; s=mail; t=1465726392;
bh=6R+sDK3a+Nm8ONd5nWdnHqQr8rLcG6RddSd7HT79G60=;
h=Date:From:To:Subject;
b=uGDPjM7v4HgkQ4NDpnOc2Z9u8mh4snZ9lHkaAOxupFE9mLNn2C6bsOLwvcTQnyVXs
g8pXZFVKxwGZrOciPGOVQTU5EtpecoFqTHiaVhp4K5QxrKSPM3qL+UHN5wgSu0YaAj
5jVDcfSEd/tXOton8m8bJbE/cTdyY2+gnDok+4pA=
Date: Sun, 12 Jun 2016 06:13:12 -0400 (EDT)
From: Clicks Payment
To: tahubulatbandung hotmail
Message-ID: <463059015.69.1465726392129.JavaMail.root#clickspayment>
Subject: Selamat bergabung tahubulatbandung hotmail di Clicks Payment
Content-Type: multipart/mixed;
boundary="----=_Part_68_1847825176.1465726392129"
Return-Path: root#clickspayment.com
X-OriginalArrivalTime: 12 Jun 2016 10:13:13.0077 (UTC)
FILETIME=[07378250:01D1C493]
X-MS-Exchange-Organization-Network-Message-Id:
c902588a-7a30-4663-0f04-08d392aa2cd7 X-EOPAttributedMessage: 0
X-EOPTenantAttributedMessage: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa:0
X-MS-Exchange-Organization-MessageDirectionality: Incoming
CMM-sender-ip: 31.220.107.128 CMM-sending-ip: 31.220.107.128
CMM-Authentication-Results: hotmail.com; spf=pass (sender IP is
31.220.107.128) smtp.mailfrom=root#clickspayment.com; dkim=pass header.d=clickspayment.com; x-hmca=pass
header.id=root#clickspayment.com CMM-X-SID-PRA: root#clickspayment.com
CMM-X-AUTH-Result: PASS CMM-X-SID-Result: PASS CMM-X-Message-Status:
n:n CMM-X-Message-Delivery:
Vj0xLjE7dXM9MDtsPTA7YT0wO0Q9MjtHRD0yO1NDTD02 CMM-X-Message-Info:
11chDOWqoTkt3yvh78JX2/1GLc6Fn3NhXIWFocXMiMxzKaT3WCIdutXxwVo9JvxThCDxpMlwmlBfQQ6fyD2zO6Q/qoM4Brk5AKq/qbyQyjU+FTJHPg4zzulpGSnv8MTt/Ckr0nTUcjgR22MTdoZAt5OVoNdGb/o2K72ORVABSu9K5BNHn5POGBCQlNTVXIaMi08hNzUizuIEioM75BKLogwin2khuRYQTrO6wG+PMfs=
X-MS-Exchange-Organization-SCL: 6 X-MS-Exchange-Organization-PCL: 2
X-Forefront-Antispam-Report:
EFV:NLI;SFV:SKS;SFS:;DIR:INB;SFP:;SCL:6;SRVR:HK2PR0401MB1265;H:COL004-MC5F18.hotmail.com;FPR:;SPF:None;CAT:NONE;LANG:id;CAT:NONE;
X-MS-Office365-Filtering-Correlation-Id:
c902588a-7a30-4663-0f04-08d392aa2cd7 X-Microsoft-Exchange-Diagnostics:
1;HK2PR0401MB1265;2:7I7yhjxXht1wu1qHrQ54lg3zC9MfA6WlBt9n4Ey7ruKirtxHmgwCMK3pqbaRGab2EkkUSPpku37GSSXN+5OBhDpbPsq1dFC/JVmuUWTFUmu2sKwadsNTJ0jYbMTarQAArzAoowZisDh4oarV8JCwsC9VpzM+jLrUKVFO0O3wPu5lmQyySEPBOT2+1KGizlvVuVCAxKqWR87f+QztrN85ug==;3:MbzZZnvwFDlEu7s8Win/LVW0BEtQRiajY3grrnu/4RctNiZIPfe0Ry+BpLRyY7bAHlZ4APLy/VWPEiourQrZTjO4LdcMQoS4RIWYWbrNdYUTm+B5FeFTVu5DvgebKmBTBUt7SP6PnKIvj79C76i0UIEWyVHvQDg3mJ5VD1a+meo=;25:erDwLW1PetkpjL9QCFN8BYvlD66iZ3MH7PpwBpCssUOx3l9NlcPNMkbvtq8654/Pm02zAO1NEKy7w7O5nFFlYURrngRn1+bX9R3o+8ythJZcd8AwLYLCS4z91Fi11shxW0qR6o7Rd9igHkNyyq8oEC1GuqBepc0cnplOT+EdncFJ6tJGzKFHQuTJDBGQxSm9AJdkzBV2KrvD9YRptP9IP2JxVkS9FBgchSHLWXXA4gPT1ykzZaE3o5jVapKwDeUzTWQCAdYE8+t0QWE6b9/PYGMorDp2eM44RtLGWAL7oTjKHc2iGFdC+TEwO8uOnMO9f0Na93smSLTfmKM3FcLL5JOSLsnjIaA+Tp+AA00l0iTX2IbxPawNz/eIjCZpIoEnsn13QZQaWY0xFComF/229aA0LV+E+g4Lr71/0Tl7oKS0vA2a0SqO3PBHhACCgeaD
X-Microsoft-Antispam:
BCL:0;PCL:0;RULEID:(8291501002);SRVR:HK2PR0401MB1265;
X-Exchange-Antispam-Report-CFA-Test:
BCL:0;PCL:0;RULEID:(82015046);SRVR:HK2PR0401MB1265;BCL:0;PCL:0;RULEID:;SRVR:HK2PR0401MB1265;
X-Microsoft-Exchange-Diagnostics:
1;HK2PR0401MB1265;4:YUp/5V1dNFwU4G7NhRsxCbI1Jjd+T9zOggeQ1fUwgThfDpH+F8bb4TcqYrqvbNKor6oE8KM5vL7+PsBSmbuEqG8bbC2Kexuu1o9veHRWwPii03vIYsnP3C5TXPRDcfD7kpdJA9+oWn2NVFsZx6CuYxZqHp8EqN++W0YfmfIqdt07h573bpT90txoSgVmlJ7Noxcumubl6wefCeCWqeDM5SkEMEoH7Tiq0zn8c6ChbveAZ3nk3s75jBh8jViK9CZMzJ8SI6JqWjxVcXtDiGRmuQ==;23:3ZXOE18TQxop8c4cR27I3YlhVAI55M3yqOx+qia0MAMsY9K96MAgy7hp5x0yi54mss/KkhgBVTGvTyHk+KSfnrjYsINn4PTfSPll56FvEyu/QbwowdFuXrKgrOcnptm/8E65gKwDaf5d1r/Spcw3T/aVBAtvF5q9ZJrHVsNRixujYg90+LW/9ccNwgjAmppV;6:aPDIYHsB5feRz/WdGJXQzwTQwZXWTe00L3FmigNAJrnFY8HJmi21T+ACydl/c1QKt/CdLQ0UhhAdPJisvboNzZ2o9dIjq5+IiP+0UV6UQ0+jv18ipM2EwkEpEgjht3U7kaqUCe7eIC3NTrmAfs67LzrCZSwYHscDMw6voFk93Nrhup2K6m4W6KSEpnk+ZSPoyNCFzDumcILy+IFi1IGYpf40E/FOfibzGTb9C0MQhxzRE3kXI5g/RLgOG6xRv6JMORTLODBKEZHeVDqY9RvPRM3u3r88ZtrphiS15+Z8g00ea9qcWQNTRD10jcZ0yviq;5:cy68nKmmKv0DaYm2GtRcQ301vS80x3l1b6br6shxYmNhpJRRpMUe4jGOmtRTIANdS3ju9eBQn9xtLn2p7u1DjrXhpn8kLonjEd3l865nh90uDGVczR/ebXS8IxyN4lHB9pCdehyCwGgp8EHzIW3hig==
X-Microsoft-Exchange-Diagnostics:
1;HK2PR0401MB1265;24:znstvMAJiStGTnUgjFS5tLXl7HLe3l1orbdiC4GetY+hojWKOGkvjkEdN/flhwiQ4ChXD2tq3z8hevS6/mSXsw==;7:pqHnUd1NiIYouQWHdczgOeHzujkEV5zduKi3tzRIArgXsLCbBDi1nrQwVHw9aHv+013FpzRjBEs0Er9ilovIyjK8I8RBpMSoBkwG1jM9taMYYZGlpOVKfP0pDfZEGNsoV89crb2b2RTybp/cEn1JpAvgjqxgp8wjATYoN93YTp3+O46mYdxpVCbB9nOAk/QzKj/+T6iYaWtYr6sbAtxCv0LYHbN0sh2Wvb1a2rjON3Q=
SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: SKS
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2016
10:13:16.7471 (UTC) X-MS-Exchange-CrossTenant-Id:
84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-CrossTenant-FromEntityHeader: Internet
X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR0401MB1265
X-MS-Exchange-Organization-AuthSource:
HK2APC01FT115.eop-APC01.prod.protection.outlook.com
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Transport-EndToEndLatency: 00:00:03.0905767
X-Microsoft-Exchange-Diagnostics:
=?us-ascii?Q?1;PS1PR0401MB1273;9:xXteLEoBRMm+UFOM9d+jTbeSlMZSaKXGFK85eyeI?=
=?us-ascii?Q?dsdk+Rkx1XaRHyLpD3fKliOPuUvZECMmEqBsP8IBk7gLhfztSt67ygmcHJ7W?=
=?us-ascii?Q?VCckSpoyPVuPb/L1Kf8vFMT/c5JtFfeAUGSUBr7DWZEw7BIYrQizr3yflHQx?=
=?us-ascii?Q?ayqDdai3Yft5+lTKkmsosardhmBbCWXct19V08GWY1o288MYA9Iz/cLs5mmY?=
=?us-ascii?Q?/SrjvcktD1HdCOb+bQOztlGM67ycKbkHBCBrQGX5xTWeD7vo5oSPn0u9YPgm?=
=?us-ascii?Q?vGxOvmj2Au5RxLH+voGyXZGiT8EqBx/nwZBW+EyxfNLinqP4GBdVX/fLOo4u?=
=?us-ascii?Q?2EOBY6rxTkVsaVmwcoboRT8jtpsDTBt3mTt+4llAzu+3VzG4V7PVDiIN18fL?=
=?us-ascii?Q?LbX+SWPcwCnX67cpZUNJ15ikVLwFWiRa1bt13yp5DEcf3PyFtlZ1LVdtGnPp?=
=?us-ascii?Q?GOYpt7IOomLnSi8vJyknL5VHuFEp9rNl5idAFiPENj6cmQn5qMTqtjfKjoZf?=
=?us-ascii?Q?B+mNpXkYdqAZMFvYbAwtaQBDRB5Q80SoBHWYUvri0peT0hlu0ZVL/FkV3GHo?=
=?us-ascii?Q?fpuP2LAmZvOEpaZgkUcJHeWWxhd21oND+dYGfoV2l5g6/q0dT+94/TodNpmL?=
=?us-ascii?Q?y5SnrWHmbR7/KQvuPUfUS3jbaewk+Y2e1h2//X2wfqSxjcNALAqoelNjrG1A?=
=?us-ascii?Q?4K7SPFoC9xTc1D+/1cQ4uFrKkbhkLmzMu2ZDhbPkEQaT5dGFU02GBZTOne47?=
=?us-ascii?Q?9q9EF8ftW8ct+f5TFE2l+mds7l+4wqz8yCxCOxyz8bvMKpqfJUm2MMxfjKn0?=
=?us-ascii?Q?IiSVd/9Xp3xBs4TXspxlZBBmzUH2ZI8rKLOWNMXR/BA56G4zYB8ztggSxB5q?=
=?us-ascii?Q?3sIcJvsFupc1i2bnR3eSjjROYCMJAOhoqFqG3QQHxKxka9YYhitHogkUNOLB?=
=?us-ascii?Q?hY5I4jBlaZNFxHV9cOqfWn9hrTo/pf3106J8Xs2nRMmN2a4L+xxbt+NZJLoa?=
=?us-ascii?Q?f//CvK1lfFvytjptaVgegzwcZyYd67NIZpF1UBEff+C5+F/nxsJsn//bt4eq?=
=?us-ascii?Q?gFqEguQQkadWoHPNNEJBPN66wKtA?= X-Microsoft-Antispam-Mailbox-Delivery:
abwl:0;wl:0;pcwl:0;kl:0;iwl:0;ijl:0;dwl:0;dkl:0;rwl:0;ex:0;auth:1;dest:J;WIMS-SenderIP:31.220.107.128;WIMS-SPF:clickspayment%2ec;WIMS-DKIM:clickspayment%2ec;WIMS-822:root%40clickspayment%2ecom;WIMS-PRA:root%40clickspayment%2ecom;WIMS-AUTH:PASS;ENG:(102400050)(102420017);RF:JunkEmail;OFR:SpamFilterAuthJ;
MIME-Version: 1.0
------=_Part_68_1847825176.1465726392129 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: 7bit
X-Microsoft-Exchange-Diagnostics:
=?us-ascii?Q?1;PS1PR0401MB1273;9:xXteLEoBRMm+UFOM9d+jTbeSlMZSaKXGFK85eyeI?=
=?us-ascii?Q?dsdk+Rkx1XaRHyLpD3fKliOPuUvZECMmEqBsP8IBk7gLhfztSt67ygmcHJ7W?=
=?us-ascii?Q?VCckSpoyPVuPb/L1Kf8vFMT/c5JtFfeAUGSUBr7DWZEw7BIYrQizr3yflHQx?=
=?us-ascii?Q?ayqDdai3Yft5+lTKkmsosardhmBbCWXct19V08GWY1o288MYA9Iz/cLs5mmY?=
=?us-ascii?Q?/SrjvcktD1HdCOb+bQOztlGM67ycKbkHBCBrQGX5xTWeD7vo5oSPn0u9YPgm?=
=?us-ascii?Q?vGxOvmj2Au5RxLH+voGyXZGiT8EqBx/nwZBW+EyxfNLinqP4GBdVX/fLOo4u?=
=?us-ascii?Q?2EOBY6rxTkVsaVmwcoboRT8jtpsDTBt3mTt+4llAzu+3VzG4V7PVDiIN18fL?=
=?us-ascii?Q?LbX+SWPcwCnX67cpZUNJ15ikVLwFWiRa1bt13yp5DEcf3PyFtlZ1LVdtGnPp?=
=?us-ascii?Q?GOYpt7IOomLnSi8vJyknL5VHuFEp9rNl5idAFiPENj6cmQn5qMTqtjfKjoZf?=
=?us-ascii?Q?B+mNpXkYdqAZMFvYbAwtaQBDRB5Q80SoBHWYUvri0peT0hlu0ZVL/FkV3GHo?=
=?us-ascii?Q?fpuP2LAmZvOEpaZgkUcJHeWWxhd21oND+dYGfoV2l5g6/q0dT+94/TodNpmL?=
=?us-ascii?Q?y5SnrWHmbR7/KQvuPUfUS3jbaewk+Y2e1h2//X2wfqSxjcNALAqoelNjrG1A?=
=?us-ascii?Q?4K7SPFoC9xTc1D+/1cQ4uFrKkbhkLmzMu2ZDhbPkEQaT5dGFU02GBZTOne47?=
=?us-ascii?Q?9q9EF8ftW8ct+f5TFE2l+mds7l+4wqz8yCxCOxyz8bvMKpqfJUm2MMxfjKn0?=
=?us-ascii?Q?IiSVd/9Xp3xBs4TXspxlZBBmzUH2ZI8rKLOWNMXR/BA56G4zYB8ztggSxB5q?=
=?us-ascii?Q?3sIcJvsFupc1i2bnR3eSjjROYCMJAOhoqFqG3QQHxKxka9YYhitHogkUNOLB?=
=?us-ascii?Q?hY5I4jBlaZNFxHV9cOqfWn9hrTo/pf3106J8Xs2nRMmN2a4L+xxbt+NZJLoa?=
=?us-ascii?Q?f//CvK1lfFvytjptaVgegzwcZyYd67NIZpF1UBEff+C5+F/nxsJsn//bt4eq?=
=?us-ascii?Q?gFqEguQQkadWoHPNNEJBPN66wKtA?= X-Microsoft-Antispam-Mailbox-Delivery:
abwl:0;wl:0;pcwl:0;kl:0;iwl:0;ijl:0;dwl:0;dkl:0;rwl:0;ex:0;auth:1;dest:J;WIMS-SenderIP:31.220.107.128;WIMS-SPF:clickspayment%2ec;WIMS-DKIM:clickspayment%2ec;WIMS-822:root%40clickspayment%2ecom;WIMS-PRA:root%40clickspayment%2ecom;WIMS-AUTH:PASS;ENG:(102400050)(102420017);RF:JunkEmail;OFR:SpamFilterAuthJ;
and I am going to dig what is going on in HOTMAIL.
For error Hotmail, move on http://answers.microsoft.com/en-us/outlook_com/forum/oemail-ocompose/spf-and-dkim-are-pass-but-the-email-come-to-junk/237c0d2b-350c-4a7f-9b7a-dbda8cc5af88
When you use the "mail" command, it's sending a simple plain text email message. The message you're sending with Apache Commons Email (JavaMail) is a more complex multipart message with an embedded html body. Spam filters use a variety of rules to guess at what's spam and what's not spam. No doubt something about the more complex message and/or the html content caused it to think your message was spam. The usual advice here is to make sure the full content of your message really doesn't look anything like spam (assuming it really isn't spam). Make sure all the addresses are legitimate. Make sure all the URLs point to non-spam sites. And so on.
It is done :) by fixing missed SPF + DKIM

Apache not obeying If-Modified-Since

I'm downloading a JAR file, and would like to utilize If-Modified-Since so I don't get the whole file if I don't need it, but for some reason my vanilla Apache (afaik) isn't returning the 304 correctly.
This is from wireshark:
GET /whatever.jar HTTP/1.1
If-Modified-Since: Sat, 04 Jan 2014 21:46:26 GMT
User-Agent: Jakarta Commons-HttpClient/3.1
Host: example.com
HTTP/1.1 200 OK
Date: Sat, 04 Jan 2014 20:32:31 GMT
Server: Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.8e DAV/2 mod_jk/1.2.26 PHP/5.3.6 SVN/1.4.4
Last-Modified: Sat, 04 Jan 2014 19:13:14 GMT
ETag: "b6c037-1ddad9f-d17a6680"
Accept-Ranges: bytes
Content-Length: 31305119
Vary: User-Agent
Content-Type: text/plain
... [bunch of bytes] ...
There aren't other headers I need to specify, is there? Am I missing a module that Apache needs in order to read this header correctly?
Any other thoughts or suggestions?
Here is my Java code, for reference:
File jarFile = new File(filePath);
GetMethod get = new GetMethod(downloadUrl);
Date lastModified = new Date(jarFile.lastModified());
get.setRequestHeader("If-Modified-Since", DateUtil.formatDate(lastModified));
HttpClient client = new HttpClient();
int code = client.executeMethod(get);
UPDATE: Solution
The If-Modified-Date needed to exactly match the server, and I achieved this by explicitly setting the lastModifiedDate on the downloaded file:
String serverModified = get.getResponseHeader("Last-Modified").getValue();
jarFile.setLastModified(DateUtil.parseDate(serverModified).getTime());
After doing this, subsequent calls would not download the file.
In order to use the "If-Modified-Since" header, you must send an identical header value as the "Last-Modified" header, that is Sat, 04 Jan 2014 19:13:14 GMT != Sat, 04 Jan 2014 21:46:26 GMT. Apache cannot guarantee the file wasn't modified and given a past time on purpose (perhaps through a version control roll-back).
If you want, you may check the "Last-Modified" header on the client side, by using a HeadMethod first to avoid "getting" the resource if it hasn't been modified. Then you would use a "GetMethod" if it has been modified.
See RFC2616 - Section 9, "HTTP/1.1: Method Definitions" for more.

taking mail into text boxes

I've written a function in java to get this. On the reception of an e-mail I'm storing the contents of the mail into an external file
MIME-Version: 1.0 Received: by 10.216.237.25 with SMTP id x25mr3166819weq.30.1346350346502; Thu, 30 Aug 2012 11:12:26 -0700 (PDT)Received: by 10.216.123.197 with HTTP; Thu, 30 Aug 2012 11:12:26 -0700 (PDT)Date: Thu, 30 Aug 2012 20:12:26 +0200 Message-ID: <CAEE+wmOpUFC9Nb9wNAVKsCrFRX7GmDwhDya4brB=hvRHXY6q7Q#mail.gmail.com> Subject: ok, lets see ... From: ABCD DEFG <xyz#gmail.com> To: XYX <xyz#yahoo.com>, def#gmail.com Content-Type: multipart/alternative; boundary=000e0cd5f7142581b204c87f9ed5 X-Processed-By: mx3.mail.genotec.ch X-Spam-Checksum: a84a5db7738f685c28343edc93a6546a X-Greylist: Sender IP 209.85.212.179 not delayed X-Spam-Report: ---- Start der SpamAssassin Auswertung -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -0.1 SPF_PASS SPF: sender matches SPF record 0.0 HTML_MESSAGE BODY: HTML included in message
-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
domain
-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid
---- Ende der SpamAssassin Auswertung X-GIC-MailScanner-SpamScore: -1.199
X-GIC-MailScanner-SpamCheck: ham, hits=-1.199 required=10 scantime="4.74 seconds" origip=209.85.212.179 X-Scanned-By: "MGate 1.0" on 82.195.224.57
--000e0cd5f7142581b204c87f9ed5 Content-Type: text/plain; charset=ISO-8859-1
hello worldli ... --000e0cd5f7142581b204c87f9ed5 Content-Type: text/html; charset=ISO-8859-1 hello worldli ... --000e0cd5f7142581b204c87f9ed5--
As we can see it not aligned .. I'd like to sort the data according to SENDER, RECEIVER, ACTUAL CONTENTS OF AN EMAIL, DATE (in short I want only SENDER, RECEIVER, DATE, ACTUAL DATA that's all).... how can I achieve this using JAVASCRIPT. Other unnecessary things should be avoided.... and have to display the fetched data in text-boxes ..
Let's say four text-boxes for four fields...
You can use regular expression to finish this task.
You can write 4 different regular expressions for each of the field.

How to control alignment of mail header?

I encounter a situation, when I send a email which email subject more than 80 char, sometimes the email subject will be insert a 'tab' char. I check the invalid email's mail header, they are aligned, if a mail header entry more than 80 char, it will be wrap to a new line, and insert a 'tab'. I don't know which configuration control it, javaMail setting? SMTP setting?
Sample headers:
case one: invaild email subject, inserted a char 'tab'.
Received: from as09.aaaaaaaaa.com ([192.168.1.129]) by aaaaaaaaa.com
([192.168.1.49]) with ESMTP (TREND IMSS SMTP Service 7.0; TLS:
TLSv1/SSLv3,168bits,DES-CBC3-SHA) id ba8afe04001a23ba ; Wed, 1 Feb 2012
16:17:10 +0800
Received: from as09 (localhost [127.0.0.1])by as09.aaaaaaaaa.com
(8.13.8+Sun/8.13.8) with ESMTP id q118HAgi021891;Wed, 1 Feb 2012 16:17:10
+0800 (HKT)
Message-ID: <25866052.1328084230581.JavaMail.oracle#as09>
Date: Wed, 1 Feb 2012 08:17:10 +0000
From: <sss#abc.com>
To: ben#abc.com,
john#abc.com,
jimmy#abc.com
Subject: test Daily report for city pairs of iPhone App enquiries indocument
version Demo Customer/Test/Test/123/1231
CC: sam#abc.com
MIME-Version: 1.0
case two: valid email subject, just wrapped
Received: from as08.aaaaaaaaa.com ([192.168.1.104]) by aaaaaaaaa.com
([192.168.1.49]) with ESMTP (TREND IMSS SMTP Service 7.0; TLS:
TLSv1/SSLv3,168bits,DES-CBC3-SHA) id c356e969001b37a5 ; Fri, 3 Feb 2012
09:16:58 +0800
Received: from as08.aaaaaaaaa.com (localhost [127.0.0.1]) by
as08.aaaaaaaaa.com (8.13.4+Sun/8.13.4) with ESMTP id q131Gw1l006160; Fri, 3
Feb 2012 09:16:58 +0800 (HKT)
Message-ID: <17351450.1328231818282.JavaMail.oracle#as08.aaaaaaaaa.com>
Date: Fri, 3 Feb 2012 01:16:58 +0000
From: <sss#abc.com>
To: ben#abc.com
Subject: test Daily report for city pairs of iPhone App enquiries in
document version Demo Customer/Test/Test/123/1231
CC: sam#abc.com
sample java code:
public void sendEmail(Request req) throws Exception {
Session mailSession;
MimeMessage msg;
Properties mailSessionProp = new Properties();
mailSessionProp.put("mail.smtp.host", "localhost");
mailSessionProp.put("mail.smtp.port", "25");
mailSession = Session.getInstance(mailSessionProp, null);
msg = new MimeMessage(mailSession);
msg.addRecipients("TO", InternetAddress.parse(req.getRecipientAddress()));
msg.setSubject(MimeUtility.encodeText(req.getSubject(), "UTF-8", "B"));
msg.setHeader("X-Mailer", "");
msg.setSentDate(new Date());
msg.setContent(req.getMessage(), req.getMessageContentType().getType());
Transport.send(msg);
}
JavaMail:
Manifest-Version: 1.0
Implementation-Version: 1.3.3_01
Specification-Title: JavaMail(TM) API Design Specification
Specification-Version: 1.3
Extension-Name: javax.mail
Created-By: 1.3.1 (Sun Microsystems Inc.)
Implementation-Vendor-Id: com.sun
Implementation-Vendor: Sun Microsystems, Inc.
Specification-Vendor: Sun Microsystems, Inc.
SCCS-ID: #(#)javamail.mf 1.5 02/03/14
This behaviour is correct according to http://www.faqs.org/rfcs/rfc2822.html
2.2.3. Long Header Fields
Each header field is logically a single line of characters comprising the field name, the colon, and the field body. For convenience however, and to deal with the 998/78 character limitations per line, the field body portion of a header field can be split into a multiple
line representation; this is called "folding". The general rule is that wherever this standard allows for folding white space (not simply WSP characters), a CRLF may be inserted before any WSP.
JavaMail will wrap the header when you call setSubject(), and unwrap it when you call getSubject().

Send meeting invitation mail over Google app engine

i want to send iCalendar meeting invitations. I am using Google App engine, Java.
I managed to send a mail with an iCalendar file as an attachment, but programs like Outlook do not automatically recognize it as a meeting invitation.
I figure, i have to set the content-type of the attachment to: "text/calendar; method=REQUEST", but it seems to me, GAE is not accepting this?
Update: I was wrong above. I actually found, that i have to send the mail with the iCalendar part directly in the content, not as an attachment! So my problem is, GAE seems not to accept setting the content-type of the message itself.
Has anyone succesfully send a meeting invitation iCalendar element through mail using GAE?
Update:
I understand, i have to be more specific. In fact, i want to send iMip messages. iMip messages are not multipart, their content-type is "text/calendar". And in the case of sending a meeting invitation, it would be "text/calendar;method=REQUEST". So i tried this:
Message msg = new MimeMessage(session);
msg.setContent(iCalendarAsString, "text/calendar;method=REQUEST");
Then i send the message with Transport.send(..);
In the logs in the development server of GAE i then see, that the content type is "text/plain".
that's why i said, i think, GAE is not accepting setting a different content type.
Or am i wrong?
Update 2
OK, here's the complete code:
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
try {
Message msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("ical#someapp.appspotmail.com", "SomeApp"));
msg.addRecipient(Message.RecipientType.TO,
new InternetAddress("me#mydomain.de", "Sven Busse"));
msg.setSubject("meeting invitation!");
msg.setContent(iCalendarAsString, "text/calendar;method=REQUEST");
Transport.send(msg);
} catch (AddressException e) {
log.warning(e.toString());
e.printStackTrace();
} catch (MessagingException e) {
log.warning(e.toString());
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
log.warning(e.toString());
e.printStackTrace();
}
So, i set the content-type to "text/calendar;method=REQUEST". And once i send, this is the logs:
14.09.2011 09:52:59 com.google.appengine.api.mail.dev.LocalMailService log
INFO: MailService.send
INFO: From: SomeApp <ical#someapp.appspotmail.com>
INFO: To: Sven Busse <me#mydomain.de>
INFO: Reply-to: SomeApp <ical#someapp.appspotmail.com>
INFO: Subject: meeting invitation!
INFO: Body:
INFO: Content-type: text/plain
INFO: Data length: 458
So, the logs don't look pretty, but you can see, the content-type has changed to "text/plain".
Update 3:
Delivered-To: me#mydomain.de
Received: by 10.68.59.7 with SMTP id v7cs112540pbq;
Thu, 15 Sep 2011 07:45:55 -0700 (PDT)
Received: by 10.52.95.44 with SMTP id dh12mr1121151vdb.20.1316097954738;
Thu, 15 Sep 2011 07:45:54 -0700 (PDT)
Return-Path: <3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo#2uix4h7xygsz66weerlq.apphosting.bounces.google.com>
Received: from mail-vw0-f69.google.com (mail-vw0-f69.google.com [209.85.212.69])
by mx.google.com with ESMTPS id o9si1579035vcv.136.2011.09.15.07.45.53
(version=TLSv1/SSLv3 cipher=OTHER);
Thu, 15 Sep 2011 07:45:53 -0700 (PDT)
Received-SPF: pass (google.com: domain of 3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo#2uix4h7xygsz66weerlq.apphosting.bounces.google.com designates 209.85.212.69 as permitted sender) client-ip=209.85.212.69;
Authentication-Results: mx.google.com; spf=pass (google.com: domain of 3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo#2uix4h7xygsz66weerlq.apphosting.bounces.google.com designates 209.85.212.69 as permitted sender) smtp.mail=3oQ9yTgoJCgIdqqmngvqpciockn.eqouxgp.dwuugiqqingockn.eqo#2uix4h7xygsz66weerlq.apphosting.bounces.google.com
Received: by vws20 with SMTP id 20so3831617vws.4
for <me#mydomain.de>; Thu, 15 Sep 2011 07:45:53 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.236.187.1 with SMTP id x1mr5481998yhm.8.1316097953249; Thu, 15
Sep 2011 07:45:53 -0700 (PDT)
Reply-To: SomeApp <ical#someapp.appspotmail.com>
X-Google-Appengine-App-Id: someapp
Message-ID: <20cf305e2551fe38a104acfbee28#google.com>
Date: Thu, 15 Sep 2011 14:45:53 +0000
Subject: meeting invitation!
From: SomeApp <ical#someapp.appspotmail.com>
To: Sven Busse <me#mydomain.de>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes
BEGIN:VCALENDAR
PRODID:-//Ben Fortuna//iCal4j 1.0//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:REQUEST
BEGIN:VEVENT
DTSTAMP:20110915T144552Z
UID:20110915T144552Z-1#someapp.appspotmail.com
SUMMARY:tolles projekt\, macht viel spass.
DTSTART;VALUE=DATE:20110919
DTEND;VALUE=DATE:20110926
DESCRIPTION:tolles projekt\, macht viel spass.
ATTENDEE;ROLE=REQ-PARTICIPANT;RSVP=TRUE:mailto:me#mydomain.de
ORGANIZER:mailto:ical#someapp.appspotmail.com
END:VEVENT
END:VCALENDAR
Maybe you should think of using a service like http://context.io/ ?
(not affiliated !)

Categories

Resources