Solved

sending an email through my application

Posted on 2010-08-19
4
280 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
What is Usenet? There are many different opinions on exactly what Usenet is an isn't. Many opinions are incorrect simply out of ignorance. The Wikipedia listing about Usenet does a good job of explaining it, so instead of repeating it all here I wi…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

679 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