Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
一般来说,这应该可行,您“只需”自己实现整个 SMTP 协议 。 维基百科上提供了相关介绍。我真的会为此使用图书馆。
In general this should work, you 'just' have to implement the whole SMTP protocol yourself. An introduction is available on Wikipedia. I'd really use a library for this.
我想说你应该为此使用一个库。如果这确实是一个 Gmail 帐户,您需要验证自己的身份,因为 Gmail 不允许匿名 smtp。我不知道套接字的java细节,但一般来说,您应该对套接字做更多的事情而不仅仅是创建一个。 unix 网络编程第一部分介绍了套接字的使用。即邮件服务器发送对您的请求的答复,您也可以从套接字对中读取该答复。
I would say you should use a library for this. If this is really a gmail account you need to authenticate yourself because gmail doesn't allow anonymous smtp. I don't know the java details for sockets, but in general you should do more with sockets than just create one. unix network programming part I covers the use of sockets. i.e. the mailserver sends an answer to your requests which you could also read from your socket pair.