GetRelayServerFromEmailAddress Method
Gets the host name of the domain willing to
accept the mails for the specified e-mail address or an empty string if error
occurred.
The developer can use the obtained name of SMTP server to send the message to
the account on this server without any authentication.
[Visual Basic] blnResult = ObjectName.GetRelayServerFromEmailAddress(EmailAddress,[DNSServer],[SingleAttemptOnly],[Timeout]) |
Parameters: | ||
EmailAddress As String | The e-mail address. | |
DNSServer As String |
(optional) The IP address of the DNS server. If this parameter is ommited, MailBee extracts it from Windows settings.
Also, the developer can also specify two DNS servers to increase the reliability of DNS MX lookup operation. The semicolon (;) is used as a delimeter character. For instance, the "125.145.34.4" or "45.15.6;45.22.22.2" values are supported. |
|
SingleAttemptOnly As String | (optional) If True, MailBee won't send request second time if the first one fails. Less reliable but faster. The default is False. | |
Timeout as Long | (optional) Number of seconds to wait for response from the DNS servers. The default value is 3. | |
Return valueAs String | The string containing the name of SMTP MX server. For instance, if the "brown@domain.com" address is specified, the "smtp.domain.com" value could be returned. |
Usage example:
' This example creates a new message and sends it without any authentication Dim Mailer Mailer.LicenseKey = "Put your license key here" ' Specify the e-mail address of message sender Mailer.FromAddr = "john@domain.com" ' Specify the e-mail address of message recipient
Mailer.ToAddr = "barbara@domain.com" ' Specify the subject of the message
Mailer.Subject = "Hi, Barbara." ' Specify the text of the message body
Mailer.BodyText = "How are you?" ' Extract the name of the SMTP server to be used to sent the message Mailer.ServerName = objSMTP.GetRelayServerFromEmailAddress("barbara@domain.com") ' Send the composed message without any authentication Mailer.Send ' Disconnect from the mail server
Mailer.Disconnect
See Also:
Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.