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: '[email protected]'; password: '???'.
client
openOnHost: (NetNameResolver addressForName: 'smtp.beta9.be')
port: 2525.
client
mailFrom: '[email protected]'
to: #('[email protected]')
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: '[email protected]' to: #('[email protected]') 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 <[email protected]> wrote:
>
> On 20 Sep 2011, at 17:56, Larry White wrote:
>
> > On Tue, Sep 20, 2011 at 2:16 AM, Sven Van Caekenberghe <[email protected]>
> > 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
>