简体   繁体   English

使用 Java 使用 GMAIL 发送电子邮件

[英]Send emails with GMAIL using java

If it possible to send emails with Gmail without the need to provide username and password from an interface, I want to make a class or a method and inside this calss or method put the password and username and then send the email, I read this question but they sais that you ned to provide the username and password using a interface, I want to create and automatic process that send automatic emails.如果可以在不需要从界面提供用户名和密码的情况下使用 Gmail 发送电子邮件,我想创建一个类或一个方法,并在这个类或方法中输入密码和用户名,然后发送电子邮件,我阅读了这个问题但是他们说您需要使用界面提供用户名和密码,我想创建自动发送电子邮件的自动过程。

this is the question I read这是我读到的问题

Send email using java 使用java发送电子邮件

You could hard code the credentials, but someone could read these credentials if you share the source or executable form - this is at your risk.您可以对凭证进行硬编码,但如果您共享源代码或可执行表单,则有人可以读取这些凭证 - 这由您承担风险。 Every time you would like to send an email you need to provide the credentials, as it is in the answer from which you would like to get the code, the method takes credentials as parameters every time you send an email, but since the credentials will be hard coded, you don't need to enter them in GUI - it will be automatic.每次您想发送电子邮件时,您都需要提供凭据,因为它在您希望从中获取代码的答案中,每次发送电子邮件时,该方法都将凭据作为参数,但由于凭据将是硬编码的,您不需要在 GUI 中输入它们 - 这将是自动的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM