Email in VB.Net - need the value for the client.Host
Posted on 2010-09-22
I am running a VB.Net application and need to send emails on server "220.127.116.114" 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"
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)
'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)
'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