How to send email using gmail.smtp over a proxy server with vb.net

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello
i am working on a my project, which send email to me using gmail.smtp, it works fine on xp, vista, and + some of windows 7 versions, in few pcs i had tried that, and got a issue.
here is detail of error i got in there, i am using visual studio 2008 & a internet with proxy server,

in my openion its a problem with internet ? maybe ? because when i had used this on my dsl connection it worked.
is there anything to add ? for proxy servers ?
if i compile it & run it via F5 error shows like this
"A first chance exception of type System.Net.Mail.SmtpException occurred in System.dll"<br/>

if i run it direct my.exe than error show like this
************** Exception Text **************<br/>
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: The remote name could not be resolved: smtp.gmail.com<br/>
at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout)<br/>
at System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback)<br/>
at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)<br/>
at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)<br/>
at System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port)<br/>
at System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port)<br/>
at System.Net.Mail.SmtpClient.GetConnection()<br/>
at System.Net.Mail.SmtpClient.Send(MailMessage message)<br/>
--- End of inner exception stack trace ---<br/>
at System.Net.Mail.SmtpClient.Send(MailMessage message)

here is my code
i have imported "Imports System.Net.Mail" :D if you ask about it :)

<br/>

<pre class="prettyprint lang-vb Dim mail As New MailMessage()
Dim SmtpServer As New SmtpClient
Dim Info As String
Dim Message As String
SmtpServer.Credentials = New Net.NetworkCredential(ID.Text, PWD.Text)
SmtpServer.Port = 587
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
mail.To.Add(To.Text)
mail.From = New MailAddress("myaddress@temp.com")
mail.Subject = ("Welcome")
mail.Body = Message.Text
SmtpServer.Send(mail)[/code]
Thanks in Advance :)
<br/>


View the full article
 
Back
Top