GetAllEmailServers Method


Retrieve all recipient's local SMTP server addresses via DNS lookup

[Syntax]
Visual C++: HRESULT GetAllEmailServers(BSTR EmailAddr, BSTR* pVal)
Visual Basic: GetAllEmailServers(EmailAddr As String) As String

Parameters

EmailAddr
Email address for SMTP server lookup.

Return Value

If this method succeeds, the return value is all the SMTP server addresses of specified email addresses with each server address separated by semicolon; otherwise the return value is null.

Remarks

In general, we send email via specified SMTP server. How does the specified SMTP server know what address this email should be sent to? The answer is... it queries MX record of recipient's domain via DNS lookup. It then forwards this email to the SMTP server queried from DNS server. If recipient's server doesn't work fine, sender's SMTP server will send a failure-delivery report to the sender telling it failed to send out the email.
How does EASendMail SMTP component work with "Send email Directly"? Firstly, it queries MX record for recipient address from DNS, then sends email to recipient's email server directly. In short, if no SMTP server is specified in the code, EASendMail will send email to recipient directly.
See Also

Send Email without SMTP server(DNS lookup)
ServerAddr Property
ImportMailEx Method