Can't send email with proxy server - vb.net

I'm having a problem inside work, trying to send an email.
I think this is because we use a Proxy Server, however I can't find anyway of programming a proxy into VB.net, any helpers?
I keep getting the following error:
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 173.194.66.109:25
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6)
at System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback)
at System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback)
at System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout)
at System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint)
at System.Net.Mail.SmtpClient.GetConnection()
at System.Net.Mail.SmtpClient.Send(MailMessage message)
--- End of inner exception stack trace ---
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at SENpic.Email.butSendEmail_Click(Object sender, EventArgs e) in C:\Users\Graham\Documents\Visual Studio 2010\Projects\Email Project\EmailTest\Email.vb:line 28
Here is the code:
Try
Dim Smtp_Server As New SmtpClient
Dim e_mail As New MailMessage()
Smtp_Server.UseDefaultCredentials = False
Smtp_Server.Credentials = New Net.NetworkCredential("mymail#gmail.com", "password")
Smtp_Server.Port = 25 '587
Smtp_Server.EnableSsl = True
Smtp_Server.Host = "smtp.gmail.com"
e_mail = New MailMessage()
e_mail.From = New MailAddress(txtEmailFrom.Text, "SENpic CSP")
e_mail.To.Add("fred2000#aol.com")
e_mail.Subject = txtEmailSubject.Text
e_mail.IsBodyHtml = False
e_mail.Body = txtEmailMessage.Text
Smtp_Server.Send(e_mail)
MsgBox("Your email has been sent", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "EMail...")
Catch error_t As Exception
WriteToLogFile("Email: ", error_t.ToString)
MsgBox(error_t.ToString)
End Try
Any help is much appreciated.
Thanks
Graham

Related

AccessViolationException with provider OraOLEDB.Oracle on 12C?

We were using Oracle 11g with MSDAORA as a provider but since MSDAORA will be deprecated we have to move to a new provider for the connection string. We're also using Oracle Client 12c right now
Before we were using: Provider=MSDAORA.1;Password=;User ID=;Data Source=****11G.WORLD; Persist Security Info=True
Now we're trying to use: Provider=OraOLEDB.Oracle;OLEDB.NET=true;PLSQLRSet=true; Password=;User ID=*;Data Source=****11G.world;Persist Security Info=True
The problem is IIS crashes, and we got this exception, we have been trying to solve this issue for weeks and no luck yet:
Exception Details
SystemAccessViolationException Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Data.Common.UnsafeNativeMethods.1CommandTextExecute(IntPtr pUnkOuter, Guid& riid, tagDBPARAMS pDBParams, IntPtr& pcRowsAffected,
Object& ppRowset)
at System.Data.01eDb.0IeDbCommand.ExecuteCommandTextForSingleResult(tagDBPAFtAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
at System.Data.01eDb.01eDbCommand.ExecuteReaderIntemal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.01eDb.0IeDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior
behavior)
at System.Data.Common.DbDataAdapter.Filllnternal(DataSet dataset, DataTable0 datatables, Int32 startRecord, Int32 maxRecords, String
srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTableD dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command,
CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at M.Planned_DataloadDataCurGrid() in D: Projects\ M\Planned_Data.aspx.vb:line 637
at M.Planned_Data.cmbProgram_SelectedIndexChanged(Object sender, EventArgs e) in DAProjectAM \Planned_Data.aspx.vb:line
484
at System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs
e)
at System.Web.ULWebControls.DropDownListRaisePostDataChangedEvent()
at System.Web.UI.WebControls.DropDownListSystem.Web.ULIPostBackDataHandler.RaisePostDataChangedEvento
at System.Web.ULPage.RaiseChangedEvents()
This is a simple minimum reproduction:
Public Sub LoadGrid()
Dim ocn As OleDbConnection = New OleDbConnection("Provider=OraOLEDB.Oracle;OLEDB.NET=true;PLSQLRSet=true; Password=*****;User ID=*****;Data Source=****11G.world;Persist Security Info=True")
Dim oda As New OleDbDataAdapter
Dim odataSet As New DataTable
Dim opm As OleDbParameter
Dim oCmd As New OleDbCommand
opm = New OleDbParameter("pi_language_code", OleDbType.Char)
opm.Value = "E"
oCmd.Parameters.Add(opm)
opm = New OleDbParameter("pi_year_id", OleDbType.Integer)
opm.Value = "2020"
oCmd.Parameters.Add(opm)
opm = New OleDbParameter("pi_month_id", OleDbType.Integer)
opm.Value = "2"
oCmd.Parameters.Add(opm)
opm = New OleDbParameter("pi_program_id", OleDbType.Integer)
opm.Value = "4"
oCmd.Parameters.Add(opm)
opm = New OleDbParameter("pi_location_id", OleDbType.Integer)
opm.Value = "2"
oCmd.Parameters.Add(opm)
Try
ocn.Open()
oCmd.Connection = ocn
oCmd.CommandType = CommandType.StoredProcedure
oCmd.CommandText = "***********"
oCmd.ExecuteNonQuery()
oda.SelectCommand = oCmd
odataSet.Clear()
oda.Fill(odataSet) 'This is where it crashes
Dim rowcount As Integer = odataSet.Rows.Count
dgCurrentYear.DataSource = odataSet
dgCurrentYear.DataBind()
If rowcount > 0 Then
dgCurrentYear.Visible = True
Else
dgCurrentYear.Visible = False
End If
Catch ex As OleDbException
' Display the error
Catch ex As Exception
' Display the error
Finally
' Clean up
If (Not ocn Is Nothing) AndAlso (Not ocn.State = ConnectionState.Closed) Then
ocn.Close()
End If
ocn = Nothing
opm = Nothing
End Try
End Sub
so we solved the problem by removing the line oCmd.ExecuteNonQuery()
Because I don't have to call ExecuteNonquery since the fill method of the DataAdapter is taking care of that.
Programming Practice: Using ExecuteNonQuery with SqlDataAdapter

How do I use VB.NET to send an email from an Outlook account?

I'm trying to send an email via an outlook email account through a vb.net program. When I run the code I get an error telling me that I don't have a secure connection. I've been searching online and have tried all the adjustments I've found but I'm still not having any luck.
Here is my code at the moment(specific email addresses and passwords are changed):
Private Sub LEmail_Click(sender As Object, e As EventArgs) Handles LEmail.Click
Try
Dim SmtpServer As New SmtpClient("smtp.outlook.com")
Dim mail As New MailMessage()
SmtpServer.Credentials = New Net.NetworkCredential("sample#outlook.com", "Password")
SmtpServer.Port = 587
SmtpServer.EnableSsl = True
mail = New MailMessage()
mail.From = New MailAddress("sample#outlook.com")
mail.To.Add("recipient#gmail.com")
mail.Subject = "Test Mail"
mail.Body = "This is for testing SMTP mail from OUTLOOK"
SmtpServer.UseDefaultCredentials = False
SmtpServer.Send(mail)
MessageBox.Show("mail sent")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Any suggestions and help would be greatly appreciated. Thanks :)
EDIT: I've also tried SmtpServer.Port = 25
EDIT 2: Error message reads:
System.Net.Mail.SmtpExeption: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM as System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response) at System.Net.Mail.MailCommand.Sent(SmtpConnection conn, Byte[] command, MailAddress from, Boolean allowUnicode) at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, Boolean allowUnicode, SmtpFailedRecipientException& exception) at System.Net.Mail.SmtpClient.Send(MailMessage message) at WindowsApplication.Form1.LEmail_Click(Object sender, EventArgs e) in C:\Users\Monica\Documents\Current\Visual Studio\WindowsApplication\Form1.vb:line 553
EDIT 3: Second Error:
System.Net.Mail.SmtpException: Mailbox unavailable. The server response was: 5.3.4 Requested action not taken; We noticed some unusual activity in your Hotmail account. To help protect you, we've temporarily blocked your account. at System.Net.Mail.DataStopCommand.CheckResponse(SmtpStatusCode statusCode, String serverResponse) at System.Net.Mail.DataStopCommand.Send(SmtpConnection conn) at System.Net.Mail.SmtpConnection.OnClose(Object sender, EventArgs args) at System.Net.CloseableStream.Close() at System.Net.MailWriter.Close() at System.Net.Mail.SmtpClient.Send(MailMessage message) at WindowsApplication.Form1.LEmail_Click(Object sender, EventArgs e) in C:\User\Monica\Documents\Current\Visual Studio\WindowsApplication\Form1.vb:line 553
change the smtpserver from smtp.outlook.com to smtp-mail.outlook.com
web.config settings
<mailSettings>
<smtp deliveryMethod="Network" from="yourname#outlook.com">
<network host="smtp-mail.outlook.com" userName="yourname#outlook.com" password="passwordhere" port="587" enableSsl="true"/>
</smtp>
</mailSettings>
Add this:
SmtpServer.UseDefaultCredentials = false
before this line:
SmtpServer.Credentials = New Net.NetworkCredential("sample#outlook.com", "Password")
[Whoever designed this API obviously wasn't thinking like a consumer!]

Asp.net application suddenly stopped responding to requests

Good day, I am a newbie in .net programming and also IIS web deployment configuration.
Currently, I have an asp.net application that runs using Framework 4.5 on IIS. For the first month of having the application deployed on the server, it was running fine and smoothly. However, recently the application had issues whereby the login page would actually load but when the users key in their credentials, the page loading timer would show and it disappears, leaving the user stranded, unable to login.
In addition, the server had undergone security procedures as stated below:
Windows Hardening (Using Windows Server 2012)
SQL Server Hardening (SQL Server 2012) and port was changed to 8001
Also, the architecture of the application is that:
The Application is deployed in AMLWEB server
The SQL Server Database is in AMLDB server
So, the connection actually goes across server and the login authentication is actually authenticated against Active Directory.
The screenshot as attached:
Unhandled exception screenshot
When checked on the event viewer, the below warning was seen that may suggest to be contributing to the issue:
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 1/18/2015 5:27:15 PM
Event time (UTC): 1/18/2015 9:27:15 AM
Event ID: 2ac169fff7284e86b7b0844e5d9ccab1
Event sequence: 4
Event occurrence: 1
Event detail code: 0
Application information:
Application domain: /LM/W3SVC/1/ROOT/AML-1-130660468323976167
Trust level: Full
Application Virtual Path: /AML
Application Path: D:\AML\
Machine name: AMLWEB
Process information:
Process ID: 6756
Process name: w3wp.exe
Account name: IIS APPPOOL\.NET v4.5
Exception information:
Exception type: InvalidOperationException
Exception message: The ConnectionString property has not been initialized.
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at DBManager.DBManager.OpenConnection(String DBStrConn, Int16 DBType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\DBManager\DBManager.vb:line 50
at DBManager.DBManager.ExecuteSQLQuery_ReturnDS(String& ReturnErrorMsg, String SqlString, String DBConnString, Int16 DBType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\DBManager\DBManager.vb:line 190
at SQLAdminQueryManager.AdminQueryManager.AdminQueryManager_Staff_Login.Staff_Login_Retreive(cor_staff AppEntity, String DbSQLConnString, String DbType, String& ReturnErrorMsg, Object& ReturnObjDataset, String AccessType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\SQLAdminQueryManager\AdminQueryManager.vb:line 65
at Login_page_LDAP_Code.LoginButton_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Request information:
Request URL: https://amlweb/AML/Login_page.aspx
Request path: /AML/Login_page.aspx
User host address: 10.1.67.61
User:
Is authenticated: False
Authentication Type:
Thread account name: IIS APPPOOL\.NET v4.5
Thread information:
Thread ID: 10
Thread account name: IIS APPPOOL\.NET v4.5
Is impersonating: False
Stack trace: at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at DBManager.DBManager.OpenConnection(String DBStrConn, Int16 DBType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\DBManager\DBManager.vb:line 50
at DBManager.DBManager.ExecuteSQLQuery_ReturnDS(String& ReturnErrorMsg, String SqlString, String DBConnString, Int16 DBType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\DBManager\DBManager.vb:line 190
at SQLAdminQueryManager.AdminQueryManager.AdminQueryManager_Staff_Login.Staff_Login_Retreive(cor_staff AppEntity, String DbSQLConnString, String DbType, String& ReturnErrorMsg, Object& ReturnObjDataset, String AccessType) in C:\Users\TESS-HP003\Desktop\AML\ES_Library\SQLAdminQueryManager\AdminQueryManager.vb:line 65
at Login_page_LDAP_Code.LoginButton_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Custom event details:
However, the connection string was indeed had been set up properly as below:
Web.config
<connectionStrings>
<add name="AMLDBConnectionString" connectionString="Data Source=AMLDB01, 8001;Initial Catalog=AML_DB;integrated security=true; uid=sa; pwd=p#ssw0rd"/>
</connectionStrings>
And it was set up as a global variable as so:
GlobalSQLConnString = ConfigurationManager.ConnectionStrings("AMLDBConnectionString").ToString
GlobalDBType As Int16 = 1
The line which actually executed to connect to the DB:
blnReturnValue = objSqlQuery.Staff_Login_Retreive(objBE, GlobalSQLConnString, GlobalDBType, strErrorMsgReturn, returnDS, "S")
The method invoked:
Public Function Staff_Login_Retreive(ByVal AppEntity As BusinessEntities.cor_staff, _
ByVal DbSQLConnString As String, ByVal DbType As String, _
ByRef ReturnErrorMsg As String, ByRef ReturnObjDataset As Object, _
Optional ByVal AccessType As String = "S") As Boolean
With AppEntity
SQlQuery = "SELECT * "
SQlQuery += " FROM cor_staff "
SQlQuery += " WHERE cor_staff.cor_userid =N'" & AppEntity.cor_userid & "'"
End With
'
If AccessType.ToUpper = "R" Then
ReturnObjDataset = ExecuteSQLQuery_ReturnIDR(ReturnErrorMsg, SQlQuery, DbSQLConnString, DbType)
Else
ReturnObjDataset = ExecuteSQLQuery_ReturnDS(ReturnErrorMsg, SQlQuery, DbSQLConnString, DbType)
End If
'
If ReturnErrorMsg.Trim.Length = 0 Then
Return True
Else
Return False
End If
'
End Function
Edited
Since the above code would actually run through and would actually be invoked on this line:
ReturnObjDataset = ExecuteSQLQuery_ReturnDS(ReturnErrorMsg, SQlQuery, DbSQLConnString, DbType)
The connection would only be opened here:
Public Function ExecuteSQLQuery_ReturnDS(ByRef ReturnErrorMsg As String, ByVal SqlString As String, ByVal DBConnString As String, ByVal DBType As Int16) As DataSet
ReturnErrorMsg = ""
Dim DS As New DataSet
'
If DBType = 1 Then
Try
OpenConnection(DBConnString, DBType)
Dim sqlCmd As New SqlCommand(SqlString, sqlConn)
sqlCmd.CommandTimeout = 0
Dim sqlDaAdp As New SqlDataAdapter(sqlCmd)
sqlDaAdp.Fill(DS)
sqlCmd = Nothing
sqlDaAdp = Nothing
CloseConnection(DBType)
Return DS
Catch ex As SqlException
If ex.Number = 18456 Or ex.Number = 4060 Then
ReturnErrorMsg = "Database Connection Error >> Error No : " & ex.Number
Else
ReturnErrorMsg = "SQL Statement Error >> Error No : " & ex.Number
End If
CloseConnection(DBType)
Return Nothing
End Try
ElseIf DBType = 3 Then
Try
OpenConnection(DBConnString, DBType)
Dim oledbCmd As New OleDbCommand(SqlString, oleDbconn)
Dim oledbDaAdp As New OleDbDataAdapter(oledbCmd)
oledbDaAdp.Fill(DS)
oledbDaAdp = Nothing
oledbDaAdp = Nothing
CloseConnection(DBType)
Return DS
Catch ex As OleDbException
If ex.ErrorCode = -2147217887 Then
ReturnErrorMsg = "Database Connection Error >> Error Code : " & ex.ErrorCode
Else
ReturnErrorMsg = "SQL Statement Error >> Error Code : " & ex.ErrorCode
End If
CloseConnection(DBType)
Return Nothing
End Try
End If
'
Return Nothing
'
End Function
Open connection method:
Public Sub OpenConnection(ByVal DBStrConn As String, ByVal DBType As Int16)
Try
If DBType = 1 Then
sqlConn = New SqlConnection(DBStrConn)
If sqlConn.State = ConnectionState.Closed Then
sqlConn.Open()
Else
sqlConn.Close()
sqlConn.Open()
End If
ElseIf DBType = 3 Then
oleDbconn = New OleDbConnection(DBStrConn)
If oleDbconn.State = ConnectionState.Closed Then
oleDbconn.Open()
Else
oleDbconn.Close()
oleDbconn.Open()
End If
End If
'
Catch ex As Exception
Throw
End Try
End Sub
End of edited part
Does anyone have any idea why does such exception would occur?
So far, I've done the following to actually try to debug this issue:
Restart IIS
Restart Application Pool
Recycle Application Pool (every 12 hours, 8 a.m. and 8 p.m. specifically)
Restart SQL Server Service
None of the above worked. But when I actually tried accessing the application from a specific floor in which is the Security Team floor, the application actually starts functioning as usual, and others could actually access the application as well.
Please help, I'm totally going out of my mind about this issue.
Does it have anything to do with my deployment method, iis configuration or programming, I'm willing to listen to suggestions.
Thanks for your time.

Visual basic 2010 send email using gmail SMTP

I want to send email from my Visual basic form
my code:
Private Sub email1()
Try
Dim Smtp_Server As New SmtpClient
Dim e_mail As New MailMessage()
Smtp_Server.UseDefaultCredentials = False
Smtp_Server.Credentials = New Net.NetworkCredential("MYEMAIL#gmail.com", "MYPASS")
Smtp_Server.Port = 465
Smtp_Server.EnableSsl = True
Smtp_Server.Host = "smtp.gmail.com"
e_mail = New MailMessage()
e_mail.From = New MailAddress("MYEMAIL#gmail.com")
e_mail.To.Add("MYFRIENDEMAIL#gmail.com")
e_mail.Subject = "SUBJECT"
e_mail.IsBodyHtml = False
e_mail.Body = "TEXT MESSAGE"
Smtp_Server.Send(e_mail)
Catch error_t As Exception
email_status.Text = ("Error: " & error_t.Message)
MsgBox(error_t.Message)
Exit Sub
End Try
email_status.Text = ("OK")
End Sub
errors while using smtp.gmail.com
while using SMTP port 465: The operation has timed out.
while using SMTP port 587: Failure sending email.
while using SMTP port 25: Failure sending email.
errors while using smtp.googlemail.com
while using SMTP port 465: The operation has timed out.
while using SMTP port 587: Failure sending email.
while using SMTP port 25: Failure sending email.
i am using AVAST antivirus but i turned it off
can you please help me?
thank you very much.

System.Net.Mail VB.NET 3.5 System.Net.Mail.SmtpException

I have searched the net thoroughly for a solution to this and have yet to find one.
I'm trying to establish a simple mail client to send text documents as raw text through SMTP. To do this I am using the System.Net.Mail library under VB.Net version 3.5
Whenever I try to send a message, I receive a System.Net.Mail.SmtpException.
I have tried using different mail providers, under different settings and have yet to solve this problem. This problem has been tested on 3 separate computers, all with different specifications.
The code is as follows:
Private Sub SendEmailMessage()
Try
If My.Computer.Network.IsAvailable Then
If DataValid() Then
'Data is valid, send the eMail.
Dim MailReceiver As String = txtReceiver.Text
'Create the eMail Message.
'Dim message As New MailMessage(from:=txtMailAddress.Text, to:=MailReceiver, subject:="(MTG) <CARD> " & ID, body:="<p>" & ConstructedFileString() & "<p>")
Dim message As New MailMessage
Dim MessageFrom As New MailAddress(txtMailAddress.Text)
Dim MessageTo As New MailAddress(MailReceiver)
With message
.From = MessageFrom
.To.Add(MailReceiver)
.Subject = "(MTG) CARD " & ID
.IsBodyHtml = True
.Body = "<p>" & ConstructedFileString() & "<p>"
End With
'Establish eMail Client
Dim emailClient As New SmtpClient()
Dim emailCredentials As New Net.NetworkCredential
With emailCredentials
.UserName = txtMailAddress.Text
.Password = txtPassword.Text
.Domain = "gmail.com"
End With
With emailClient
.Host = txtHostServer.Text
.Port = txtPort.Text
.Credentials = emailCredentials
.EnableSsl = chkSSL.Checked
.Timeout = 5000
End With
'Dim MailDomain As String = ""
'Dim PositionAt As Byte = 0
'PositionAt = txtMailAddress.Text.IndexOf("#")
'For i = PositionAt + 1 To Len(txtMailAddress.Text)
' MailDomain = MailDomain & txtMailAddress.Text.Chars(i)
'Next
'Debug.Print(MailDomain)
If My.Computer.Network.Ping(hostNameOrAddress:=emailClient.Host) Then
'Send the message.
emailClient.Send(message)
Else
'Could not ping, do not send.
ErrorOut("Could not reach the eMail Server.")
End If
Else
'Data is not valid, do not send the eMail.
End If
Else
ErrorOut("No network could be found. Check your network configurations.")
End If
Catch ex As Security.SecurityException
'Security exception
ErrorOut("A Security Exception was raised.")
Catch ex As Net.NetworkInformation.NetworkInformationException
'Network info exception
ErrorOut("Exception raised when retrieving network information.")
Catch ex As Net.NetworkInformation.PingException
'Ping exception
ErrorOut("Exception raised when pinging the network.")
Catch ex As Net.Mail.SmtpFailedRecipientException
'Recipient exception
ErrorOut("Mail Recipient Exception raised.")
Catch ex As Net.Mail.SmtpException
'Mail Server Exception
ErrorOut("Mail Server Exception raised")
Catch ex As Exception
'Generic Exception raised.
ErrorOut("General Exception raised", True)
End Try
End Sub
Any help on this matter is greatly appreciated, thanks.
Stack trace:
System.Net.Mail.SmtpException: The operation has timed out.
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at NetProj.EmailDialog.SendEmailMessage() in ...
I believe this is the famous SSL issue with System.Net.Mail
http://blogs.msdn.com/b/webdav_101/archive/2008/06/02/system-net-mail-with-ssl-to-authenticate-against-port-465.aspx
It was there in framework 3.5 not sure about 4.0 if they fixed it or not.