Search code examples
javaemailoutlooksmtpjakarta-mail

How to get SMTP host name and port number from webmail


Is there anyway to get the smtp host name and port number from outlook webmail or ms outlook?my webmail url looks like https://name.domain/owa/. when i tried to telnet using command - telnet name.domain 25,i got a response as shown below,

220 name.smdomain.local Microsoft ESMTP MAIL Service ready at Sun, 8 Nov
2015 19:55:54 +1100

can i assume that my corporate smtp server name is name.smdomain.local and port number is 220? or is there any better way to find it out?

I need smtp server details for sending an auto generated mail using java mail api

Regards Libin Sebastian


Solution

  • You can retrieve the SMTP server name from the MX DNS record, but that will be a server accepting incoming SMTP messages. The outgoing SMTP server can be and in most cases is different.

    It is also not in the autodiscover XML returned by the Exchange server.

    There is no generic way to retrieve the SMTP server name based on an SMTP address or the name of an OWA server.