Solved

sending an email through my application

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

706 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

19 Experts available now in Live!

Get 1:1 Help Now