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

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

Related

HTTP not getting back 304

Hey I am trying to build an HTTP client, and I can't seem to figure out why I am not getting the code "304, not modified". The last modified date for the file is in 2007 and I am accessing it 10 yrs later.
Here is the output
HTTP/1.1 200 OK
Date: Tue, 03 Oct 2017 21:50:33 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) OpenSSL/1.0.2k-fips
Last-Modified: Fri, 31 Aug 2007 04:21:06 GMT
ETag: "c12-438f726ceb080"
Accept-Ranges: bytes
Content-Length: 3090
Content-Type: image/gif
and the java code for reference, I am using sockets.
Date d = new Date();
outputStream.print("HEAD "+ "/" + pathName + " HTTP/1.1\r\n");
outputStream.print("If-Modified-Since: " + d.toString() + "\r\n");
outputStream.print("Host: " + hostString+"\r\n");
outputStream.print("\r\n");
outputStream.flush();
any help would be appreciated, I am new to HTTP clients.
You might need to format the date you're using for the "If-Modified-Since" header. Here's the syntax (taken from here):
If-Modified-Since: day-name, day month year hour:minute:second GMT
Example:
If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT

ews-java-api: Error on item update: At least one recipient isn't valid

I am working on a tool which uses ews-java-api to create, update and delete calendar items in Outlook agenda. It has been working fine, but now sometimes when it tries to update some calendar item, I get following error:
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: At least one recipient isn't valid., A message can't be sent because it contains no recipients.
at microsoft.exchange.webservices.data.core.response.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:278)
at microsoft.exchange.webservices.data.core.response.ServiceResponse.throwIfNecessary(ServiceResponse.java:267)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:165)
at microsoft.exchange.webservices.data.core.ExchangeService.internalUpdateItems(ExchangeService.java:691)
at microsoft.exchange.webservices.data.core.ExchangeService.updateItem(ExchangeService.java:762)
at microsoft.exchange.webservices.data.core.service.item.Item.internalUpdate(Item.java:279)
at microsoft.exchange.webservices.data.core.service.item.Item.update(Item.java:400)
at be.vrt.quintiqexchange.main.QuintiqAdapter.insertUpdateCalendarItems(QuintiqAdapter.java:879)
at be.vrt.quintiqexchange.main.QuintiqAdapter.updateCalendarItems(QuintiqAdapter.java:796)
at be.vrt.quintiqexchange.main.QuintiqAdapter.run(QuintiqAdapter.java:286)
at java.lang.Thread.run(Thread.java:745)
Recently all the exchange accounts have been migrated from local Outlook servers to Office365 cloud servers. Maybe this has something to do with it? Or anybody have any idea on what is going wrong?
Following code is to perform the update for an item:
Item it = alitems.get(i);
...
it.update(ConflictResolutionMode.AlwaysOverwrite);
Following is the url being used to access office365 ews:
exchangewebservice = https://outlook.office365.com/EWS/Exchange.asmx
Thanks in advance
Edit: I use ews-java-api version 2.0
Edit: Here you can see that the error occurs on one line and than the next line, with the same recipient it doesn't occur...
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: At least one recipient isn't valid., A message can't be sent because it contains no recipients.
at microsoft.exchange.webservices.data.core.response.ServiceResponse.internalThrowIfNecessary(ServiceResponse.java:278)
at microsoft.exchange.webservices.data.core.response.ServiceResponse.throwIfNecessary(ServiceResponse.java:267)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:165)
at microsoft.exchange.webservices.data.core.ExchangeService.internalUpdateItems(ExchangeService.java:691)
at microsoft.exchange.webservices.data.core.ExchangeService.updateItem(ExchangeService.java:762)
at microsoft.exchange.webservices.data.core.service.item.Item.internalUpdate(Item.java:279)
at microsoft.exchange.webservices.data.core.service.item.Item.update(Item.java:400)
at be.vrt.quintiqexchange.main.QuintiqAdapter.insertUpdateCalendarItems(QuintiqAdapter.java:880)
at be.vrt.quintiqexchange.main.QuintiqAdapter.updateCalendarItems(QuintiqAdapter.java:703)
at be.vrt.quintiqexchange.main.QuintiqAdapter.run(QuintiqAdapter.java:283)
at java.lang.Thread.run(Thread.java:745)
WARN be.vrt.quintiqexchange.main.QuintiqAdapter - At least one recipient isn't valid., A message can't be sent because it contains no recipients.by UPDATE for subject: on Thu Jun 23 14:00:00 CEST 2016 Thu Jun 23 19:00:00 CEST 2016 of user name.lastname#domain.com
INFO be.vrt.quintiqexchange.main.QuintiqAdapter - Appointment updated for subject: NIET DAG on Fri Aug 05 10:00:00 CEST 2016 Fri Aug 05 18:00:00 CEST 2016 of user name.lastname#domain.com
INFO be.vrt.quintiqexchange.main.QuintiqAdapter - Appointment updated for subject: PROEF st5 on Mon Aug 22 10:00:00 CEST 2016 Mon Aug 22 20:30:00 CEST 2016 of user name.lastname#domain.com
This means that the recipient isn't really the issue, I guess...
p.s. I replaced the original mailaddress but believe me, it's a correct mailadres :)
In my case, if the address is not properly trimmed and has any whitespace characters at all, EWS vomits this exception up.

Twitter4j issues with user's protected data

I am using twitter java api tweet4j in order to retrieve data from twitter users. I ve got a list of users ids from which I want to retrieve data. I read a list of string ids and I am trying to extract data via twitter java api into my database. However, some users has protection on their data. Thus, I am getting authentication errors, in some ids. Since my list is enormous, how is it possible to automatically create exceptions from user with no authentication right? Is there any method in twitter4j for protected or not protected users?
The error that I am getting:
Exception in thread "main" 401:Authentication credentials
(https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have
set valid consumer key/secret, access token/secret, and the system clock is in sync.
[Wed Apr 30 15:35:18 EEST 2014]date: Wed, 30 Apr 2014 12:36:58 GMT
[Wed Apr 30 15:35:18 EEST 2014]x-transaction: 0d6f0c50c647c52e
[Wed Apr 30 15:35:18 EEST 2014]pragma: no-cache
[Wed Apr 30 15:35:18 EEST 2014]cache-control: no-cache, no-store, must-revalidate, pre-
check=0, post-check=0
{"request":"\/1.1\/statuses\/user_timeline.json?
user_id=787323013&include_my_retweet=true&include_entities=true","error":"Not
authorized."}
[Wed Apr 30 15:35:18 EEST 2014]x-content-type-options: nosniff
[Wed Apr 30 15:35:18 EEST 2014]x-xss-protection: 1; mode=block
[Wed Apr 30 15:35:18 EEST 2014]x-rate-limit-limit: 180
Relevant discussions can be found on the Internet at:
[Wed Apr 30 15:35:18 EEST 2014]expires: Tue, 31 Mar 1981 05:00:00 GMT
http://www.google.co.jp/search?q=0742d262 or
http://www.google.co.jp/search?q=32729de5
[Wed Apr 30 15:35:18 EEST 2014]set-cookie: guest_id=v1%3A139886141837883092;
Domain=.twitter.com; Path=/; Expires=Fri, 29-Apr-2016 12:36:58 UTC
[Wed Apr 30 15:35:18 EEST 2014]set-cookie: lang=en
[Wed Apr 30 15:35:18 EEST 2014]www-authenticate: OAuth realm="https://api.twitter.com"
[Wed Apr 30 15:35:18 EEST 2014]content-length: 143
[Wed Apr 30 15:35:18 EEST 2014]x-rate-limit-reset: 1398862209
[Wed Apr 30 15:35:18 EEST 2014]server: tfe
[Wed Apr 30 15:35:18 EEST 2014]strict-transport-security: max-age=631138519
[Wed Apr 30 15:35:18 EEST 2014]x-access-level: read-write-directmessages
[Wed Apr 30 15:35:18 EEST 2014]{"request":"\/1.1\/statuses\/user_timeline.json?
user_id=787323013&include_my_retweet=true&include_entities=true","error":"Not
authorized."}
TwitterException{exceptionCode=[0742d262-32729de5], statusCode=401, message=null,
code=-1, retryAfter=-1, rateLimitStatus=RateLimitStatusJSONImpl{remaining=114,
limit=180, resetTimeInSeconds=1398862209, secondsUntilReset=890}, version=4.0.1}
at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:164)
at twitter4j.HttpClientBase.request(HttpClientBase.java:53)
at twitter4j.HttpClientBase.get(HttpClientBase.java:71)
at twitter4j.TwitterImpl.get(TwitterImpl.java:1968)
at twitter4j.TwitterImpl.getUserTimeline(TwitterImpl.java:156)
at twitter4j.TwitterImpl.getUserTimeline(TwitterImpl.java:177)
at twitter4j.examples.tweets.UpdateStatus.main(UpdateStatus.java:116)
You should catch the exception and continue processing, something like this:
for (long userId : userIds) { // presumably you have a list of users
try {
// call twitter4j here and process results
}
catch (TwitterException e) {
// do not throw if user has protected tweets, or if they deleted their account
if (e.getStatusCode() == HttpResponseCode.UNAUTHORIZED ||
e.getStatusCode() == HttpResponseCode.NOT_FOUND) {
// log something here
}
else {
throw e;
}
}
}

Java POP3 message parser without JavaMail API

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.

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