View Poll Results: did this help you

Voters
0. You may not vote on this poll
  • yes

    0 0%
  • no

    0 0%
  • sort of

    0 0%
  • not really

    0 0%
Results 1 to 2 of 2

Thread: vb.net 2005 smtp is great, need help on proxy please

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    14

    vb.net 2005 smtp is great, need help on proxy please

    Hi,
    got the template manager in fantastic shape its big and has batch runs as well with huge amounts of code, thanks to you.
    but
    we have a last part of this to send email through the proxy at work in exchange for it to all run right, we usually use the xp_sendmail in sql server which is operating so we know we can send mail to exchange from things, any suggestion ?

    This old external smtp server works fine:

    Dim mail As New MailMessage()
    mail.From = New MailAddress("[email protected]")
    mail.To.Add("[email protected]")
    mail.Subject = "test subject line"
    Dim mailcontenturl As String = "http://www.google.com/"
    mail.Body = GetHTML(mailcontenturl)
    mail.IsBodyHtml = True
    Dim smtp As New SmtpClient()

    smtp.Credentials = New System.Net.NetworkCredential("[email protected]", "password")
    smtp.Port = 587
    smtp.Host = "smtp.domain.com"
    smtp.Send(mail)
    MsgBox("Mail Sent")

    Private Function GetHTML(ByVal url As String) As String
    Dim wReq As WebRequest = System.Net.HttpWebRequest.Create(url)
    Dim sr As New StreamReader(wReq.GetResponse().GetResponseStream())
    Dim result As String = sr.ReadToEnd()
    sr.Close()
    Return result
    End Function


    This does not:


    Dim mail As New MailMessage()
    mail.From = New MailAddress("[email protected]")
    mail.To.Add("[email protected]")
    mail.Subject = "test subject line"
    Dim mailcontenturl As String = "http://www.google.com/"
    mail.Body = GetHTML(mailcontenturl)
    mail.IsBodyHtml = True
    Dim smtp As New SmtpClient()

    Dim ws As New System.Net.WebClient

    Dim ProxyObject As New WebProxy("http://192.168.1.1:8080/", True)

    Dim cred As New NetworkCredential("domain\test", "password", "domain.com")

    ws.Proxy = ProxyObject

    smtp.Port = 25

    smtp.Host = "mail.domain.com" '// exchange server

    smtp.Send(mail)


    Private Function GetHTML(ByVal url As String) As String
    Dim wReq As WebRequest = System.Net.HttpWebRequest.Create(url)
    Dim sr As New StreamReader(wReq.GetResponse().GetResponseStream())
    Dim result As String = sr.ReadToEnd()
    sr.Close()
    Return result
    End Function



    keep getting that 407 proxy credentials required, do you have any thoughts on this code, thanks

    is there any way to send mail using the exchange server name like this ?

    smtp.Host = "ExchangeServer.Local.com"

    we have xp_sendmail working on the ms sql server inside of stored procedures, is there a way to use that here ? thanks.
    Last edited by outta; Mar 6th, 2009 at 04:55 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width