locked
Remote name could not be resolved . RRS feed

  • Question

  • hi ,
    Iam trying to add mail options in my application

    When i run iam get the following Error
    Remote name could not be resolved 'smtp.gmail.com'

    My application is running on system which is in network,
    LAN Server has proxy.
    Is there a way to by pass Proxy?


    Iam using the below code
    SendMessage("cde@gmail.com", "abc@hotmail.com", Body, "Subject goes here")
     
     Public Sub SendMessage(ByVal [To] As String, ByVal Fromm As String, ByVal Body As String, ByVal Subject As String)
    
            Dim too As New MailAddress([To])
    
            Dim from As New MailAddress(Fromm)
    
            Dim message As MailMessage = New MailMessage(from, too) ' subject, body)
    
            message.Subject = Subject
    
            message.Body = Body
    
            Dim client As SmtpClient = New SmtpClient("smtp.gmail.com", 465)
    
            client.Timeout = 30000
    
            client.EnableSsl = True
    
            client.Credentials = New System.Net.NetworkCredential("abc@gmail.com", "123", "") 
    
    
            Try
    
                client.Send(message)
    
            Catch e As Exception
    
                Me.Text = e.Message + " " & e.InnerException.Message
    
            End Try
    
            Me.Opacity = 100
        End Sub

    How to send emails using Outlook express?
    Will this issue solve if i use Outlook Express?

    Kindly Reply,
    sql.devloper


    Tuesday, April 7, 2009 7:48 AM

Answers

  • Thanks for all your support,
    I solved the issue
    I added MAPI controls to the form
     With AxMAPISession1
                        .DownLoadMail = False
                        .LogonUI = True
                        .SignOn()
                        .NewSession = True
                        AxMAPIMessages1.SessionID = .SessionID
                    End With
                    With AxMAPIMessages1
                        .Compose()
                        .RecipAddress = "XXX@hotmail.com"
                        .AttachmentPathName = Filename
                        .AddressResolveUI = True
                        .ResolveName()
                        .MsgSubject = "hi"
                        .MsgNoteText = Text
                        .Send(False)
                    End With
                    AxMAPISession1.SignOff()
                    'sendmail = True

    Using above code,i was able to send Mails
    Anyhow,I was not able to send mails using SMTP,
    I tried opening the Ports 587,465,
    But as iam working on intranet,was not able to bypass proxy

    Thanks again for all your Support.
    sql.developer



    Friday, April 10, 2009 6:26 AM

All replies

  • Try port 587
       Dim client As SmtpClient = New SmtpClient("smtp.gmail.com", 587)
    


    Arjun Paudel
    Tuesday, April 7, 2009 9:08 AM
  • Try port 587
       Dim
     client As
     SmtpClient = New
     SmtpClient("smtp.gmail.com"
    , 587)
    


    Arjun Paudel
    Thanks for your reply,

    I tried ,It didnt work,same error is coming

    Is that because of Proxy?
    kindly reply

    Tuesday, April 7, 2009 9:15 AM
  • Do you have firewall? If yes make sure port 587 not being blocked.
    Arjun Paudel
    Tuesday, April 7, 2009 9:17 AM
  • Thanks for the mail,
    I will check it.
    Could you please tell ways to send mail using outlook?
    If i try using outlook express will the same issue come?
    kindly reply,
    sql.developer

    Tuesday, April 7, 2009 9:33 AM
  • Mail Using Microoft Outlook

    Add Reference to Microsoft.Office.Interop.Outlook (project add reference)

    At top of your form, put
    Imports outlook = Microsoft.Office.Interop.Outlook

    And Code
    Dim OutlookMessage As outlook.MailItem
            Dim AppOutlook As New outlook.Application
            Try
                OutlookMessage = AppOutlook.CreateItem(outlook.OlItemType.olMailItem)
                'Dim Recipients As outlook.Recipients = OutlookMessage.Recipients
                Dim Recipients As outlook.Recipients
                Recipients = OutlookMessage.Recipients
                Recipients.Add("arjun***@hotmail.com")
                OutlookMessage.Subject = "Sending through Outlook"
                OutlookMessage.Body = "Testing outlook Mail"
                OutlookMessage.CC = Nothing
                OutlookMessage.BodyFormat = outlook.OlBodyFormat.olFormatHTML
                OutlookMessage.Send()
            Catch ex As Exception
                MessageBox.Show("Mail could not be sent") 'if you dont want this message, simply delete this line
            Finally
                OutlookMessage = Nothing
                AppOutlook = Nothing
            End Try


    Arjun Paudel
    Tuesday, April 7, 2009 11:29 AM
  • Thanks for the Mail,
    I could not locate Microsoft.Office.Interop.Outlook
    I dont have MS office 2003 in my System(i have  MS office 2000)

    Dim OutlookMessage As Outlook.MailItem
            Dim AppOutlook As New Outlook.Application
            Try
                OutlookMessage = AppOutlook.CreateItem(Outlook.OlItemType.olMailItem)
                Dim Recipients As Outlook.Recipients = OutlookMessage.Recipients
                'Dim Recipients As Outlook.Recipients
                Recipients = OutlookMessage.Recipients
                Recipients.Add("...@hotmail.com")
    
                OutlookMessage.Subject = "Sending through Outlook"
                OutlookMessage.Body = "Testing outlook Mail"
                OutlookMessage.CC = Nothing
                'OutlookMessage.BodyFormat = Outlook.OlBodyFormat.olFormatHTML
                OutlookMessage.Send()
            Catch ex As Exception
                MessageBox.Show("Mail could not be sent") 'if you dont want this message, simply delete this line
            Finally
                OutlookMessage = Nothing
                AppOutlook = Nothing
            End Try

    when i added OutlookMessage.Display(False)

    i can see outlook window opened but when i click send .its not sending


    Kindly Reply,



    Tuesday, April 7, 2009 12:19 PM
  • Hi Sql.developer,

    1. Don't have Outlook2000 currently. Just see this article about one issue of Outlook2000 automation. Take it to see whether it is applied for your scenario.

    2. Read this article about using VB6 to automate Outlook 2000. Using Outlook object are similar in VB6 and VB.NET. It is just for your reference.

    Riquel
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, April 9, 2009 5:50 AM
    Moderator
  • Thanks for all your support,
    I solved the issue
    I added MAPI controls to the form
     With AxMAPISession1
                        .DownLoadMail = False
                        .LogonUI = True
                        .SignOn()
                        .NewSession = True
                        AxMAPIMessages1.SessionID = .SessionID
                    End With
                    With AxMAPIMessages1
                        .Compose()
                        .RecipAddress = "XXX@hotmail.com"
                        .AttachmentPathName = Filename
                        .AddressResolveUI = True
                        .ResolveName()
                        .MsgSubject = "hi"
                        .MsgNoteText = Text
                        .Send(False)
                    End With
                    AxMAPISession1.SignOff()
                    'sendmail = True

    Using above code,i was able to send Mails
    Anyhow,I was not able to send mails using SMTP,
    I tried opening the Ports 587,465,
    But as iam working on intranet,was not able to bypass proxy

    Thanks again for all your Support.
    sql.developer



    Friday, April 10, 2009 6:26 AM
  • Remote name could not be resolved 'smtp.gmail.com'

    Hi.

    Speak abut Proxy in this case is void.

    if see this: Remote name could not be resolved 'smtp.gmail.com'

    in windows cmd prompt type "ping smtp.gmail.com" without " " and get the IP address like

    209.85.143.109(this is same smtp.gmail.com )

    and put that IP address instead smtp.gmail.com in code

    that is 100% will be usefull.

     


    Saturday, October 8, 2011 1:12 PM
  • Solveing way for:remote name could not be resolved 'smtp.gmail.com'

    Hi.

    Speaking abut Proxy in this case is void.

    if see this :Remote name could not be resolved 'smtp.gmail.com'

    in windows cmd prompt type "ping smtp.gmail.com" without " " and get the IP address like

    209.85.143.109(this is same smtp.gmail.com )

    and put that IP address instead smtp.gmail.com in code

    that is 100% will be usefull.


    Saturday, October 8, 2011 1:14 PM