In a Java program, what is the best way of determining if an SMTP server is ready to accept and send an email?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
You can use JavaMail API and try to send an email.
If you don't want to actually send the email, you can open a TCP socket to port number 25 of your mail server and send the following commands:
Make sure you check all server responses after each command issued. If you don't see any errors until that point, then probably you will be able to send emails with that SMTP server.
And, as Jordan Stewart kindly appointed: