I have used java mail(com.sun.mail.smtp) from my struts project. Mail is sent successfully but the receiver end the mail so delayed. It will take 2 or 3 hrs.
When am using PHP mailer with the same smtp settings , there is no delay, mail is working perfectly.
Anybody facing this issue, know what is the reason?
Javamail doesn’t store and forward messages. So if you have have successfully sent the email to the mail server by calling Transport.sendMessage() and not receiving an error. It’s sitting on the mail server waiting to be delivered. You’ll need to check what you have set as your smtp server, user name, and password. Those are what you send to Transport.connect(server, username, password). Make sure they are the same as the ones you are using in PHP. If you aren’t setting them in PHP then I bet you aren’t using the same settings and hence why one server takes longer than the other.
Put some timing statements around the calls to Transport.connect(), Transport.sendMessage(), Transport.close(). See how long its taking to make it through that section. If its taking really short time then you know the error exists on the mail server side. And I bet you aren’t talking to the server you think you are talking to.