property Message.Host as String

Retrieves or sets a value that indicates the host's address where the message should be delivered.

TypeDescription
String A String expression that indicates the host where the message should be delivered.

By default, the message's Host is empty. If the Host is empty, the control queries the DNS for the SMTP servers where the email should be delivered. You can use the Host property to force control using a certain SMTP server. If the Host is not empty, the Send method does not query the DNS server for the mail exchange information. If the Host property is not empty, the component doesn't check if the host is valid. Use the LastError property to check the last error occurred. 

The following sample shows how to use Host property:

Dim WithEvents e As EMail

Private Sub e_EndSend(ByVal Msg As EXEMAILLibCtl.IMessage)
    Debug.Print e.Error(Msg.LastError)
End Sub

Private Sub Form_Load()
    Set e = Runtime1.NewEMail()
    Dim m As Message
    Set m = Runtime1.NewMessage
    Set m.Notifier = e
    m.Host = "unknown.com"
    m.Send "me", "mike2@Unknown.com", "Test", "Hello world!"
End Sub