!include once #1015973 // JavaMail // user can be raw google user name or include "@gmail.com" or "@googlemail.com" // auto-get password from JavaX-Secret dir static void quickGMail(S user, S to, S subject, S text) { quickGMail(user, null, to, subject, text); } // I wanted to return the message id, but how to get it? static void quickGMail(S user, S pass, S to, S subject, S text) ctex { print("Logging in to GMail to send mail..."); user = gmailGetHandle(user); MimeMessage message = newGMail(user, pass); message.setFrom(new InternetAddress(user)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to)); message.setSubject(subject); message.setText(text); Transport.send(message); print("Sent email from " + user + "@gmail.com to " + to + ": " + quote(subject)); }
Began life as a copy of #1003304
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003682 |
Snippet name: | quickGMail - sends a simple text mail through GMail |
Eternal ID of this version: | #1003682/2 |
Text MD5: | 8d011198debd269de3eda069973b34c0 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-06-19 16:03:32 |
Source code size: | 834 bytes / 22 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 781 / 758 |
Version history: | 1 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |