简体   繁体   English

Java Web应用程序-如何通过同一服务器发送电子邮件?

[英]Java web application- How to send email through the same server?

I have a java web application system. 我有一个Java Web应用程序系统。 In the system, there are a number of users. 在系统中,有许多用户。 For example, there are 10 different users in the system. 例如,系统中有10个不同的用户。

Each user have the feature to send a email to the other users within the same system. 每个用户都具有向同一系统内的其他用户发送电子邮件的功能。 From what I read,it seems Java Mail API is an option but it's for sending to email client server instead. 据我了解,似乎Java Mail API是一个选项,但它是用于发送到电子邮件客户端服务器的。

What I want is when the recipient user logs in to the account, he should be able to view the email within that system. 我想要的是当收件人用户登录该帐户时,他应该能够在该系统中查看电子邮件。

Can anyone give me some suggestion or what to look at to achieve this? 谁能给我一些建议或如何看待这一目标?

One possible solution to implement an in-application messaging system could look like this: 实现应用程序内消息传递系统的一种可能的解决方案如下所示:

You create a table for your messages. 您为您的消息创建一个表。 That table could have columns like message id, recipient (eg email adress) and content. 该表可以具有诸如消息ID,收件人(例如电子邮件地址)和内容之类的列。

When a user creates a message, you store that in the new table. 用户创建消息时,会将其存储在新表中。

When another user logs in, you make a query on that table, if there are any messages for that user (which have the users adress in the recipient column), and show those messages to the user. 当另一个用户登录时,如果该用户有任何消息(在收件人列中有用户地址),则对该表进行查询,然后将这些消息显示给该用户。 Additionally, when creating the message, you can create an event which could trigger then a push notification. 另外,在创建消息时,您可以创建一个事件,该事件可能随后触发推送通知。 There are several 3rd party providers, where you can just call an API, and the user would get a notification on his phone (you would need then at least a phone number or other identifiers for that user). 有多个第三方提供商,您可以在其中调用API,并且该用户会在其电话上收到通知(然后您至少需要该用户的电话号码或其他标识符)。

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

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