Hi Sven, When I said 'hanging' i wasn't implying that mail didn't work: it can't connect to that server without SSL. Anyway, I tried to interrupt with CMD "." - I wasn't aware of that option - but now I'm getting the error msg back so fast I can't interrupt it. Sigh. I'll keep trying when I'm not on my day job. On Wed, Sep 21, 2011 at 3:00 AM, Sven Van Caekenberghe <sven@beta9.be>wrote:
Larry,
This works for me using our own SMTP server without the SSL option. Note that we have a custom port and of course don't allow annonymous relaying.
| client | client := SMTPClient new. text := String streamContents: [ :stream | stream << 'Subject: Test'; crlf; crlf. stream << 'Hi there!'; crlf; << 'Sent from Pharo Smalltalk'; crlf ]. [ client user: 'sven@beta9.be'; password: '???'. client openOnHost: (NetNameResolver addressForName: 'smtp.beta9.be ') port: 2525. client mailFrom: 'sven@beta9.be' to: #('svc@mac.com') text: text. client quit ] ensure: [ client close ]. client
If you have Seaside in your image, look at the references of SMTPClient, they do something similar.
Next, I will subclass SMTPClient to try to do an SSL connection with our server.
Concerning the 'hanging': are you sure you cannot interrupt and enter the debugger using CMD-. ?
What version of Pharo are you using and on which platform ?
Sven
On 20 Sep 2011, at 20:13, Larry White wrote:
This is what I ran (excepting the actual email addresses).
[SMTP client deliverMailFrom: 'foo@gmail.com' to: #('bar@gmail.com') text: 'Subject: this is a test Hello from Pharo! ' usingServer: 'smtp.gmail.com' ] fork.
it fails of course (no ssl) but it hangs while it tries.
thanks.
On Tue, Sep 20, 2011 at 12:34 PM, Sven Van Caekenberghe <sven@beta9.be> wrote:
On 20 Sep 2011, at 17:56, Larry White wrote:
On Tue, Sep 20, 2011 at 2:16 AM, Sven Van Caekenberghe <sven@beta9.be> wrote:
Final question, does Pharo always block on IO? My impression was that all Smalltalks did at one time, but that some (visualworks? squeak?) had fixed that years ago.
Pharo typically blocks when the main or UI thread is doing something, which includes IO. You can perfectly do all kinds of things in other threads. Check the process monitor or try some multithreaded server.
Thanks Sven, I tried sending the email by wrapping the code in a block and sending fork to the block, but the image was still frozen until it returned. Is that the wrong way to do it?
thanks again.
I need more information and code that I can execute in order to try to help you.
Sven