Solved

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

Posted on 2010-09-22
2
532 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
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

776 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