RB NUG, Aaron....

I am trying to write a Form-to-Email CGI in RB, but console apps do not appear to connect sockets like GUI apps can.

The following code works perfectly from the Action event of a PushButton in a windowed (GUI) app, but does nothing when called from the Run event in a Console App. Any suggestions? (test this with your own email settings and password)

(Using RB 2006 release 3 Professional. MacBookPro 2.16 GHz Intel, 2 Gig RAM, Tiger 10.4.7)

  dim sock as new SMTPSocket

  sock.address = "smtp.myhost.com"
sock.port = 587 '
  sock.username = "[EMAIL PROTECTED]"
  sock.Password = "[EMAIL PROTECTED]"

  dim mail as new EmailMessage
  mail.fromAddress = "[EMAIL PROTECTED]"
  mail.addRecipient "[EMAIL PROTECTED]"
  mail.subject =  "[TEST]"
  mail.bodyPlainText = "Testing..."

  sock.messages.append mail
  sock.SendMail

In either GUI or console app, the sock.isConnected property stays false and the sock.LastErrorCode is zero (i.e. success), but mail shows up at the destination when this is run from the GUI, but not from the console App. Calling sock.connect does not correct the problem.

So, I then subclassed SMTPSocket in both GUI and Console projects so I could have access to the Events (ConnectionEstablished, MessageSent, SendComplete, ServerError, etc.). I put some trivial response code in each Event and set breakpoints on those code lines to see if the Events are fired by the application when the socket object is used. I then instantiated an object of this subclass and ran the same code as you see above.

In the GUI, the Events are fired and the breakpoints do trap at each SMTPsocket Event. However, in the Console App, the breakpoints do not trap the Events, so I am assuming the Events are never fired.

Other users have been  successful with the POP3Socket in console apps.

Why does the Console App ignore these events for the SMTPSocket class and fail to function?

Workaround???

Thanks in advance

Mark M Levinson
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Hutchinson, KS


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to