简体   繁体   English

如何向我的应用程序用户发送确认电子邮件?

[英]How can I send a confirmation email to users of my application?

I have designed a chat application where different users can create the account, but I do not know how to send a confirmation email to the users. 我设计了一个聊天应用程序,不同的用户可以在其中创建帐户,但是我不知道如何向用户发送确认电子邮件。 Since I collect their e-mail address in the registration form, how can I send mail to those addresses in Java? 由于我在注册表中收集了他们的电子邮件地址,因此我该如何用Java将邮件发送到这些地址?

First of all, you need a SMTP server . 首先,您需要一个SMTP服务器 It's required to be able to send emails. 必须能够发送电子邮件。 You can make use of the SMTP server associated with your own existing email account, such as the one from your ISP or public mailboxes like Gmail, Yahoo, etc. You can find SMTP connection details at their documentation. 您可以使用与您自己的现有电子邮件帐户相关联的SMTP服务器,例如来自ISP的电子邮件帐户或Gmail,Yahoo等公共邮箱。您可以在其文档中找到SMTP连接详细信息。 You usually just need to know the hostname and the port number. 通常,您只需要知道主机名和端口号即可。 The login details are just the same as from your email account. 登录详细信息与您的电子邮件帐户中的相同。

You're however restricted to using your own address in the From field of the email and usually also in the amount of emails you're allowed to send at certain intervals. 但是,您只能在电子邮件的“ From字段中使用自己的地址,通常也要使用允许在特定时间间隔内发送的电子邮件数量。 If you'd like to get around this, then you need to install your own SMTP server, for example Apache James , which is Java based, or Microsoft Exchange and so on. 如果要解决此问题,则需要安装自己的SMTP服务器,例如基于Java的Apache James或Microsoft Exchange等。

Then, to send an email using Java code, you would need the JavaMail API or the more convenienced Apache Commons Email . 然后,要使用Java代码发送电子邮件,您将需要JavaMail API或更方便的Apache Commons Email

This looks like a good site for you: http://www.javacommerce.com/displaypage.jsp?name=javamail.sql&id=18274 对于您来说,这似乎是一个不错的网站: http : //www.javacommerce.com/displaypage.jsp?name=javamail.sql&id=18274

Google 'send mail java' 谷歌“发送邮件Java”

The easiest way of doing this really depends on the environment that your JVM is running in. 最简单的方法实际上取决于运行JVM的环境。

If you're running in a standard Linux/UNIX environment and don't want to faff about with extra libraries, then one way is just to "manually" call sendmail (eg via ProcessBuilder). 如果您在标准Linux / UNIX环境中运行并且不想使用额外的库,那么一种方法就是“手动”调用sendmail(例如,通过ProcessBuilder)。 As with executing commands generally, you just need to be slightly careful that you don't just pass user input as parameters without screening them. 与通常执行命令一样,您只需要稍加注意,不要在不筛选用户输入的情况下就将用户输入作为参数传递。

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

相关问题 在我的Spring Boot Web应用程序中,如何在没有模板引擎的情况下发送包含html的电子邮件> - In my Spring Boot web application, how can I send an email containing html without a templating engine> 如何在创建用户时绕过确认电子邮件 - How to bypass confirmation email on Users creation 如何从Wicket应用程序发送电子邮件? - How can I send email from a Wicket application? 我如何发送我的 System.out.println(); 作为电子邮件 - How can i send my System.out.println(); as an email 如何通过JavaMail API接收已发送电子邮件的确认? - How can I recieive confirmation for delivered email with JavaMail API? 如何检查哪些所有用户已登录到我的应用程序 - How can i check which all users are logged into my application 如何从我的Swing应用程序向javascript发送字符串? - How can i send a string from my Swing application to javascript? 当用户发布 email 时,我只想在同一用户发送 email 请求之前超过 1 分钟后才发送邮件。 我怎样才能做到这一点? - when user posts email, I want to send mail only if more than 1 minute passed before same users send email request. how can I do that? 如何将JsonNode作为电子邮件附件发送 - How can I send JsonNode as an email attachment 如何使用 GMail、Yahoo 或 Hotmail 通过 Java 应用程序发送电子邮件? - How can I send an email by Java application using GMail, Yahoo, or Hotmail?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM