Download Jar. Uses 639K of libraries. Click here for Pure Java version (2351L/15K).
1 | !7 |
2 | |
3 | lib 1400085 // JavaMail |
4 | |
5 | sS recipient = "info@botcompany.de"; |
6 | //"stefan.reich.maker.of.eye@gmail.com"; |
7 | |
8 | import javax.mail.*; |
9 | import javax.mail.PasswordAuthentication; |
10 | import javax.mail.internet.*; |
11 | |
12 | p { |
13 | final S username = "stefan.reich.maker.of.eye@gmail.com"; |
14 | final S password = loadSecretTextFileMandatory("gmail-pw").trim(); |
15 | |
16 | new Properties props; |
17 | props.put("mail.smtp.auth", "true"); |
18 | props.put("mail.smtp.starttls.enable", "true"); |
19 | props.put("mail.smtp.host", "smtp.gmail.com"); |
20 | props.put("mail.smtp.port", "587"); |
21 | |
22 | Session session = Session.getInstance(props, |
23 | new javax.mail.Authenticator() { |
24 | protected PasswordAuthentication getPasswordAuthentication() { |
25 | return new PasswordAuthentication(username, password); |
26 | } |
27 | }); |
28 | |
29 | Message message = new MimeMessage(session); |
30 | message.setFrom(new InternetAddress(username)); |
31 | message.setRecipients(Message.RecipientType.TO, |
32 | InternetAddress.parse(recipient)); |
33 | message.setSubject("Testing Subject"); |
34 | message.setText("Dear Mail Crawler," |
35 | + "\n\n No spam to my email, please!"); |
36 | |
37 | Transport.send(message); |
38 | |
39 | print("Done"); |
40 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, nbgitpuheiab, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003227 |
Snippet name: | JavaMail Test (send through gmail) |
Eternal ID of this version: | #1003227/4 |
Text MD5: | 3d1517df524a527303f74b450ed24613 |
Transpilation MD5: | c59bb443b1392618309445c11d47d8d1 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-11-15 17:26:08 |
Source code size: | 1159 bytes / 40 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 735 / 1499 |
Version history: | 3 change(s) |
Referenced in: | [show references] |