开发者

Configuration of SMTP email program in Spring

开发者 https://www.devze.com 2023-04-03 00:10 出处:网络
I have written a SMTP program using javamail API. Using a simple java project.It is working fine for Gmail SMTP. Now I have to merge it with a Real time开发者_如何学Python project.I have written all l

I have written a SMTP program using javamail API. Using a simple java project.It is working fine for Gmail SMTP. Now I have to merge it with a Real time开发者_如何学Python project.I have written all logic in an IMPL class with function name sendMailSSL.Now I am asked to put all configurable information like(from,to,host,port etc) in a separate file. This is my first prj and I am not famalier with Spring so need your help in following problems.

  1. Where to keep configuration?

2.The mail program is working fine for smtp.gmail.com but not for my client.It gives error that connection time out.

Thanks in Advance


Spring offers you multiple options to store configuration. The most basic is in your Spring XML configuration files, with the configuration details stored there and injected into your Java code. Here are 2 Gmail examples:

  • http://forum.springsource.org/showthread.php?33167-How-to-use-Spring-Mail-to-send-mails-via-Gmail-s-SMTP-server.
  • http://enricogi.blogspot.com/2008/02/mail-configuration-in-spring-using.html

The second question will be answered when the first one is done (e.g., when you application is configured correctly).


Your client's ISP may be blocking outbound port 25, as they probably should. Your application needs to support sending via a smart host, and your client needs to find out from their ISP which smart host to use.

Why are you making a new SMTP client when there are already more than humankind can sustainably support?

0

精彩评论

暂无评论...
验证码 换一张
取 消