LocalIP Property


Specify the local IP address binding for sending email.

Data Type: String

Remarks

By default, Mail object uses the default IP address of current machine to send email. However, if there are mulitple IP addresses on current machine, you can specify one of IP address to bind and send the email.

Example

[Visual Basic] To get the full samples of EASendMail, please refer to Samples section.

[VB6, VBA - Set From Name]
Const ConnectNormal = 0
Const ConnectSSLAuto = 1
Const ConnectSTARTTLS = 2
Const ConnectDirectSSL = 3
Const ConnectTryTLS = 4

Private Sub SendEmail()
    Dim oSmtp As EASendMailObjLib.Mail
    Set oSmtp = New EASendMailObjLib.Mail
    oSmtp.LicenseCode = "TryIt"

    ' Your SMTP server address
    oSmtp.ServerAddr = "smtp.emailarchitect.net"

    ' Local IP address used to send email
    oSmtp.LocalIP = "192.168.0.1"

    ' User and password for ESMTP authentication
    oSmtp.UserName = "test@emailarchitect.net"
    oSmtp.Password = "test"

    ' ConnectTryTLS means if server supports SSL/TLS connection, SSL/TLS is used automatically
    oSmtp.ConnectType = ConnectTryTLS

    ' If your server uses 587 port 
    ' oSmtp.ServerPort = 587

    ' If your server uses 465 port with SSL/TLS 
    ' oSmtp.ConnectType = ConnectSSLAuto 
    ' oSmtp.ServerPort = 465

    ' If your server uses 25/587 port with SSL/TLS 
    ' oSmtp.ConnectType = ConnectSSLAuto 
    ' oSmtp.ServerPort = 587

    oSmtp.From = "Test User"
    oSmtp.FromAddr = "test@emailarchitect.net"
    oSmtp.AddRecipient "Support Team", "support@emailarchitect.net", 0

    oSmtp.Subject = "Test"
    oSmtp.BodyText = "Hello, this is a test...."

    If oSmtp.SendMail() = 0 Then
        MsgBox "Message delivered!"
    Else
        MsgBox oSmtp.GetLastErrDescription()
    End If

End Sub