Solved

sending an email through my application

Posted on 2010-08-19
4
277 Views
Last Modified: 2013-11-30
I am new to this topic

I have the code below and i want to my application to send emails.

I get the exception "the remote name "ubos.org" could not be resolved"

ubos.org is our active domain name. Also how do i know the name of the local smtp server

Thanks you and regards

Anthony Matovu




 Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        Try
            Dim mm As MailMessage = New MailMessage
            mm.From = New MailAddress("anthonymatovu@yahoo.co.uk", "Anthony Matovu")
            mm.To.Add(New MailAddress("matovu.anthony@gmail.com", "Anthony Matovu"))

            mm.Subject = "Testingf"
            mm.Body = "this is my body"
            mm.IsBodyHtml = False
            Dim client As SmtpClient = New SmtpClient("smtp.ubos.org")
            client.Credentials = Net.CredentialCache.DefaultNetworkCredentials
            client.Send(mm)
        Catch ex As Exception
            MessageBox.Show("error " & ex.ToString)
        End Try

    End Sub
0
Comment
Question by:Anthony Matovu
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
robbe earned 500 total points
ID: 33472905
This depends on which mail server you have. Are you using Exchange ? If so you can use the server name of the exchange server (you can see this in outlook). If your application has to be used outside the organisation i'd suggest you look for an alternative to send mails. The problem is port 25 is most of the time blocked by ISP's. You could ask setup SMTP on an alternative port and make forwarders from an @ ubos.org address to the yahoo and gmail addresses. This way you can connect to the SMTP server from outside without authentication.
0
 
LVL 13

Expert Comment

by:iHadi
ID: 33472943
Hi

use 'ubos.org' instead of 'smtp.ubos.org'
0
 
LVL 1

Author Comment

by:Anthony Matovu
ID: 33473495
I have tried Ihadi's approach and i get message "Unable to read data from the transport connection"

I have tried to understand what to do with robbe's solution and i cannot get through yet. How do i get the server name from outlook, i have failed. true the application is going to run on the local Intranet but i would also want to learn about the alternative methods.

Thanks
0
 
LVL 1

Author Comment

by:Anthony Matovu
ID: 33473599
Thank you It has worked,
I used nslookup on the cmd prompot
and it gave me the server name "filter.ubor.org"

robbe: can i know about the alternative methods and also how to get the name through outlook

I replace this in the code and it worked

Anthony
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

777 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