• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 544
  • Last Modified:

Email in VB.Net - need the value for the client.Host

I am running a VB.Net application and need to send emails on server "123.12.123.1234" using the domain "RRRR.info".
My email sever is on a different server the domain is "QQQQ.info"
I downloaded an email example from Microsoft. The code is below.
Question: What should I put as the value for the client.Host = "XXXXXXXX"
Thanks

        Public Shared Sub SendMessage(ByVal subject As String, ByVal messageBody As String, _
            ByVal fromAddress As String, ByVal toAddress As String, ByVal ccAddress As String)

            Dim message As New MailMessage()
            Dim client As New SmtpClient()

            'Set the sender's address
            message.From = New MailAddress(fromAddress)

            'Allow multiple "To" addresses to be separated by a semi-colon
            If (toAddress.Trim.Length > 0) Then
                For Each addr As String In toAddress.Split(";"c)
                    message.To.Add(New MailAddress(addr))
                Next
            End If

            'Allow multiple "Cc" addresses to be separated by a semi-colon
            If (ccAddress.Trim.Length > 0) Then
                For Each addr As String In ccAddress.Split(";"c)
                    message.CC.Add(New MailAddress(addr))
                Next
            End If

            'Set the subject and message body text
            message.Subject = subject
            message.Body = messageBody

            'TODO: *** Modify for your SMTP server ***
            'Set the SMTP server to be used to send the message
            client.Host = "XXXXXXXX"

            'Send the e-mail message
            client.Send(message)
        End Sub
0
n2dweb
Asked:
n2dweb
  • 2
1 Solution
 
NeogetaCommented:
XXXXXXXX should be either the ip address of the mail server you are trying to send the email to..
EG:
If I was sending mail from mail server "boris" which had the IP of 192.168.10.12 that would be the client.host I'd be sending mail from.

I hope that helps.
David
0
 
NeogetaCommented:
I'm glad it worked out for you.
Take Care
David
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now