Solved

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

Posted on 2010-09-22
2
528 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
  • 2
2 Comments
 
LVL 1

Accepted Solution

by:
Neogeta earned 500 total points
Comment Utility
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
Comment Utility
I'm glad it worked out for you.
Take Care
David
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now