Doesn't seem to be connecting! - WeOnlyDo Discussion board

Doesn't seem to be connecting! (General questions)

by nightwalker83, Saturday, August 21, 2010, 12:37 (5207 days ago)

Hi,

I don't know why but pop doesn't seem to connecting for me anymore. This is the connection code I am using:

Public Function Login()
Select Case frmSettings.cboHost.Text
Case Gmail
With Smtp
.Login = frmSettings.txtUsername.Text
.Password = frmSettings.txtPassword.Text
.HostName = smtp.gmail.com
.Authentication = AuthLogin
.Security = SecurityImplicit
.Port = 465
.Blocking = True
On Error Resume Next
.Connect
End With
With Pop3
.Login = frmSettings.txtUsername.Text
.Password = frmSettings.txtPassword.Text
.HostName = pop.gmail.com
.Authentication = AuthAny
.Security = SecurityImplicit
.Port = 995
.Blocking = True
On Error Resume Next
.Connect
End With
Case Hotmail
With Smtp
.Login = frmSettings.txtUsername.Text
.Password = frmSettings.txtPassword.Text
.HostName = smtp.live.com
.Authentication = AuthLogin
.Security = SecurityImplicit
.Port = 25
.Blocking = True
On Error Resume Next
.Connect
End With
With Pop3
.Login = frmSettings.txtUsername.Text
.Password = frmSettings.txtPassword.Text
.HostName = pop.live.com
.Authentication = AuthAny
.Security = SecurityImplicit
.Port = 995
.Blocking = True
On Error Resume Next
.Connect
End With
'Only available with the premuim service
Case Yahoomail
With Smtp
.Login = frmSettings.txtUsername.Text
.Password = frmSettings.txtPassword.Text
.HostName = plus.smtp.mail.yahoo.com
.Authentication = AuthLogin
.Security = SecurityImplicit
.Port = 465 '25
.Blocking = True
On Error Resume Next
.Connect
End With
With Pop3
.Login = frmSettings.txtUsername.Text
.Password = frmSettings.txtPassword.Text
.HostName = plus.pop.mail.yahoo.com
.Authentication = AuthAny
.Security = SecurityImplicit
.Port = 995 '110
.Blocking = True
On Error Resume Next
.Connect
End With
End Select
frmMain.Caption = frmMain.Caption + + frmSettings.cboHost.Text
End Function

Using gmail I am able to send an email but connecting to pop seems to be taking longer than it should. Is it possible to retrieve the pop transcript or is that just for the smtp component?

Thanks,


Nightwalker

Re: Doesn't seem to be connecting!

by wodDamir, Saturday, August 21, 2010, 13:24 (5207 days ago) @ nightwalker83

Nightwalker,

There's no Transcript property in pop3. However, you're saying it's not connecting. In that case, you should receive an error.

Do you get one?

Regards,
Damba

Re: Doesn't seem to be connecting!

by nightwalker83, Saturday, August 21, 2010, 14:00 (5207 days ago) @ wodDamir


Do you get one?

Connection has timeout is the error I'm getting. However, unlike with smtp I'm using the pop components built-in subs such as connected, etc to determine when to preform the action which populates the list with the mail recieved. However, the events aren't firing.

Re: Doesn't seem to be connecting!

by wodDamir, Saturday, August 21, 2010, 14:05 (5207 days ago) @ nightwalker83

Nightwalker,

You can't use events with Blocking mode, since calling a method in an event could cause unexpected behaviour.

You should either use blocking, without events (they can be used, but not for calling component's methods). Or, non-blocking with events.

Can you please remove any method calls from events?

Regards,
Damba

Re: Doesn't seem to be connecting!

by nightwalker83, Sunday, August 22, 2010, 03:39 (5206 days ago) @ wodDamir

Nightwalker,

You can't use events with Blocking mode, since calling a method in an event could cause unexpected behaviour.

I just preformed a small test to see if pop was connecting or not but it doesn't. I put the pop code behind a command button and initially set it to false then in the pop3_connectedmethod I put msgbox( connected ) and command1.enabled true. However it never reaches that point. This is after I removed the blockingmode stuff and the majority of the pop events.

I managed to get it so my code connects but the message I get is Connect to server - idle .

Re: Doesn't seem to be connecting!

by wodDamir, Sunday, August 22, 2010, 13:33 (5206 days ago) @ nightwalker83

Nightwalker,

I can't say anything *blindly*. Can you send us a sample, or debug log to techsupport@weonlydo.com?

Regards,
Damba

Re: Doesn't seem to be connecting!

by wodDamir, Sunday, August 22, 2010, 13:35 (5206 days ago) @ wodDamir

Nightwalker,

Also, please check the following URL:

http://example.weonlydo.com/index.asp?did=Reading-email-messages-from-Gmail-using-POP3-protocol

The sample shows how to connect to GMail, and retrieve emails in non-blocking mode.

Regards,
Damba

Re: Doesn't seem to be connecting!

by nightwalker83, Monday, August 23, 2010, 02:18 (5205 days ago) @ wodDamir

Hi,

I was able to use pop successfully the past couple of weeks! It has been since about the 18th of this month that I haven't been able to.
I have tested the examples that come with the pop component and they seem to only working half the time. I will send you my visual basic 6 project when I get home tonight. Although, comparing the code I used for pop to that provided in the examples I can't see anything that is different.

Re: Doesn't seem to be connecting!

by nightwalker83, Friday, August 27, 2010, 11:41 (5201 days ago) @ nightwalker83

Hi,

I was able to use pop successfully the past couple of weeks! It has been since about the 18th of this month that I haven't been able to.
I have tested the examples that come with the pop component and they seem to only working half the time. I will send you my visual basic 6 project when I get home tonight. Although, comparing the code I used for pop to that provided in the examples I can't see anything that is different.

I was able to fix the problem using the following:

Dim MsgCount
Dim WithEvents Pop3 As wodPop3Com
Private Sub Command1_Click()
Select Case cboHost.Text
Case Other
With Pop3
.HostName =
.login =
.Password =
'.Port = 110
.Connect
End With
Case Gmail
With Pop3
.HostName = pop.gmail.com
.login =
.Password =
.Port = 995
.Connect
End With
End Select
End Sub

Private Sub Form_Load()
Set Pop3 = New wodPop3Com
End Sub

Private Sub Pop3_Connected()
Debug.Print Connected
Form1.Caption = Form1.Caption & & You have & MsgCount & new messages!
Pop3.Messages.GetAll
End Sub

Private Sub Pop3_Disconnected(ByVal ErrorCode As Long, ByVal ErrorText As String)
If ErrorCode <> 0 Then
Debug.Print ErrorText
End If
End Sub


Private Sub Pop3_StateChange(ByVal OldState As WODPOP3COMLib.StatesEnum)
Me.Caption = Pop3.StateText
Debug.Print Pop3.StateText
End Sub
Private Sub Pop3_Done(ByVal ErrorCode As Long, ByVal ErrorText As String, ByVal HeadersOnly As Boolean)
Dim i As Integer
If LstNewMail.ListCount = 0 Then
For i = 0 To Pop3.Messages.Count - 1
LstNewMail.AddItem Pop3.Messages(i).FromName & ( & Pop3.Messages(i).Subject & )
Next i
End If
End Sub