Tag: google schemas

无法测试GMail自定义操作

我一直试图测试GMail的动作几天,但似乎没有用。 由于我没有注册,我使用下面的一小段Java代码,使用GMail的smtp服务器向我自己发送一封电子邮件。 消息的正文是文档的直接副本。 但是,Apps脚本版本可以正常运行。 final String username = “david.hatanian@gmail.com”; final String password = “X”; Properties props = new Properties(); props.put(“mail.smtp.auth”, “true”); props.put(“mail.smtp.starttls.enable”, “true”); props.put(“mail.smtp.host”, “smtp.gmail.com”); props.put(“mail.smtp.port”, “587”); Session session = Session.getInstance(props, new javax.mail.Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress(username)); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(username)); […]