1 | // requires !1003225 (JavaMail) |
2 | |
3 | import javax.mail.*; |
4 | import javax.mail.PasswordAuthentication; |
5 | import javax.mail.internet.*; |
6 | |
7 | static Session gmailSendSession(fS user, S pass) { |
8 | if (pass == null) pass = findGMailPassword(user); |
9 | final S _pass = pass; |
10 | |
11 | new Properties props; |
12 | props.put("mail.smtp.auth", "true"); |
13 | props.put("mail.smtp.starttls.enable", "true"); |
14 | props.put("mail.smtp.host", "smtp.gmail.com"); |
15 | props.put("mail.smtp.port", "587"); |
16 | |
17 | ret Session.getInstance(props, |
18 | new javax.mail.Authenticator() { |
19 | protected PasswordAuthentication getPasswordAuthentication() { |
20 | return new PasswordAuthentication(user, _pass); |
21 | } |
22 | }); |
23 | } |
Began life as a copy of #1003227
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003303 |
Snippet name: | gmailSendSession - open SMTP session for sending mail |
Eternal ID of this version: | #1003303/1 |
Text MD5: | 8503f13d93a34f4d7685cc7f30784315 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-07-29 16:02:41 |
Source code size: | 667 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 611 / 612 |
Referenced in: | [show references] |