Solved

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

Posted on 2010-09-22
2
536 Views
Last Modified: 2012-05-10
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
Comment
Question by:n2dweb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
Neogeta earned 500 total points
ID: 33739478
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
 
LVL 1

Expert Comment

by:Neogeta
ID: 33739709
I'm glad it worked out for you.
Take Care
David
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question