SMTPClient and SSL

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

SMTPClient and SSL

Richard Eng
I have a question about SMTPClient:

Can it negotiate with a SSL-enabled web server, such as Gmail?

Here's my situation:

Case #1:

client := SMTPClient openOnHostNamed: 'smtp.broadband.rogers.com' port: 25.
client user: '[hidden email]'; password: 'mypassword';
    login;
    initiateSession.
client mailFrom: '[hidden email]';
    recipient: '[hidden email]';
    data: 'Subject: This is a test
From: [hidden email]
To: [hidden email]

Hi.
Bye.
Richard'.
client quit.

The above works perfectly. No problemo.


Case #2:

client := SMTPClient openOnHostNamed: 'smtp.gmail.com' port: 995.
client user: '[hidden email]'; password: 'mypassword';
    login;
    initiateSession.
client mailFrom: '[hidden email]';
    recipient: '[hidden email]';
    data: 'Subject: This is a test
From: [hidden email]
To: [hidden email]

Hi.
Bye.
Richard'.
client quit.

The above doesn't work--Squeak times out and throws up the debug window to
say as much.

Now, the *only* difference I can discern between smtp.broadband.rogers.com
(port 25) and smtp.gmail.com (port 995) is that the latter is SSL-enabled.
Hence, my original question.

For what *other* reason might Gmail not be able to connect with SMTPClient?

Thanks in advance.

Regards,
Richard



Reply | Threaded
Open this post in threaded view
|

Re: SMTPClient and SSL

Göran Krampe
Hi!

> I have a question about SMTPClient:
>
> Can it negotiate with a SSL-enabled web server, such as Gmail?

No. :) Eh... "web server" is not the right word here and SMTPClient is
also the wrong class/protocol.

To *fetch* email you need to use POP3 and yes, google tells me that gmail
only offers POP3S - which is regular POP3 wrapped in SSL.

But you can wrap it outside of Squeak using stunnel. Run stunnel locally
listening on port xxx tunneling it to gmail:995. Then you use *POP3Client*
and connect to localhost on port xxx.

See for example: http://www.engelassociates.net/email.html

regards, Göran


Reply | Threaded
Open this post in threaded view
|

Re: SMTPClient and SSL

Richard Eng
In reply to this post by Richard Eng
Sorry, you're right. A typo--I meant "email server".

But I'm not sure you understand what I'm trying to do. *All* I want to do is
to use SMTPClient to *send* an email (via something like Gmail). I *don't*
care to fetch email through POP3.

So, SMTPClient *is* the correct class/protocol.  :-)

Do I need to use stunnel with SMTPClient? If so, how?

Thanks.

Regards,
Richard

-------
Hi!

> I have a question about SMTPClient:
>
> Can it negotiate with a SSL-enabled web server, such as Gmail?

No. :) Eh... "web server" is not the right word here and SMTPClient is
also the wrong class/protocol.

To *fetch* email you need to use POP3 and yes, google tells me that gmail
only offers POP3S - which is regular POP3 wrapped in SSL.

But you can wrap it outside of Squeak using stunnel. Run stunnel locally
listening on port xxx tunneling it to gmail:995. Then you use *POP3Client*
and connect to localhost on port xxx.

See for example: http://www.engelassociates.net/email.html

regards, Göran



Reply | Threaded
Open this post in threaded view
|

Re: SMTPClient and SSL

Richard Eng
Oh, and there was one other typo, too. I meant port 465, not 995. (It's so
easy to get these ports confused.)

Richard


On 12/12/07 8:10 PM, "Richard Eng" <[hidden email]> wrote:

> Sorry, you're right. A typo--I meant "email server".
>
> But I'm not sure you understand what I'm trying to do. *All* I want to do is
> to use SMTPClient to *send* an email (via something like Gmail). I *don't*
> care to fetch email through POP3.
>
> So, SMTPClient *is* the correct class/protocol.  :-)
>
> Do I need to use stunnel with SMTPClient? If so, how?
>
> Thanks.
>
> Regards,
> Richard
>
> -------
> Hi!
>
>> I have a question about SMTPClient:
>>
>> Can it negotiate with a SSL-enabled web server, such as Gmail?
>
> No. :) Eh... "web server" is not the right word here and SMTPClient is
> also the wrong class/protocol.
>
> To *fetch* email you need to use POP3 and yes, google tells me that gmail
> only offers POP3S - which is regular POP3 wrapped in SSL.
>
> But you can wrap it outside of Squeak using stunnel. Run stunnel locally
> listening on port xxx tunneling it to gmail:995. Then you use *POP3Client*
> and connect to localhost on port xxx.
>
> See for example: http://www.engelassociates.net/email.html
>
> regards, Göran



Reply | Threaded
Open this post in threaded view
|

Re: SMTPClient and SSL

Rob Withers
There is an SSL impl in squeak.  The challenge we face is to get SMTPClient
to run on top of an SSLSocket.   SSLSocket does not implement all of the
protocol of a Socket.  Also, there is nothing which tells SMTPSocket to use
an SSLSocket instead of a Socket.  You could write a subclass of SMTPClient
called SMTPOverSSLClient and do the right thing connecting and we could
extend SSLSocket to do the right thing.  I am willing to help.  Interested?

Rob

----- Original Message -----
From: "Richard Eng" <[hidden email]>
To: "The general-purpose Squeak developers list"
<[hidden email]>
Sent: Wednesday, December 12, 2007 5:26 PM
Subject: Re: SMTPClient and SSL


Oh, and there was one other typo, too. I meant port 465, not 995. (It's so
easy to get these ports confused.)

Richard


On 12/12/07 8:10 PM, "Richard Eng" <[hidden email]> wrote:

> Sorry, you're right. A typo--I meant "email server".
>
> But I'm not sure you understand what I'm trying to do. *All* I want to do
> is
> to use SMTPClient to *send* an email (via something like Gmail). I *don't*
> care to fetch email through POP3.
>
> So, SMTPClient *is* the correct class/protocol.  :-)
>
> Do I need to use stunnel with SMTPClient? If so, how?
>
> Thanks.
>
> Regards,
> Richard
>
> -------
> Hi!
>
>> I have a question about SMTPClient:
>>
>> Can it negotiate with a SSL-enabled web server, such as Gmail?
>
> No. :) Eh... "web server" is not the right word here and SMTPClient is
> also the wrong class/protocol.
>
> To *fetch* email you need to use POP3 and yes, google tells me that gmail
> only offers POP3S - which is regular POP3 wrapped in SSL.
>
> But you can wrap it outside of Squeak using stunnel. Run stunnel locally
> listening on port xxx tunneling it to gmail:995. Then you use *POP3Client*
> and connect to localhost on port xxx.
>
> See for example: http://www.engelassociates.net/email.html
>
> regards, Göran





Reply | Threaded
Open this post in threaded view
|

Re: SMTPClient and SSL

Göran Krampe
In reply to this post by Richard Eng
> Oh, and there was one other typo, too. I meant port 465, not 995. (It's so
> easy to get these ports confused.)

Which was why I immediately started talking about POP3S. :)

regards, Göran


Reply | Threaded
Open this post in threaded view
|

Re: SMTPClient and SSL

Richard Eng
In reply to this post by Richard Eng
Unfortunately, I'm a Smalltalk newbie. (After 5 months, I still don't feel
all that knowledgeable.) So I'm the wrong person to tackle something like
this.

Also, I just barely understand what a socket is.  :-(

Regards,
Richard

-------
There is an SSL impl in squeak.  The challenge we face is to get SMTPClient
to run on top of an SSLSocket.   SSLSocket does not implement all of the
protocol of a Socket.  Also, there is nothing which tells SMTPSocket to use
an SSLSocket instead of a Socket.  You could write a subclass of SMTPClient
called SMTPOverSSLClient and do the right thing connecting and we could
extend SSLSocket to do the right thing.  I am willing to help.  Interested?

Rob



Reply | Threaded
Open this post in threaded view
|

Re: SMTPClient and SSL

Rob Withers
Ok, here is what I have.  It establishes a connection and talks to the
server, but I was getting a Bad credentials error.  I have attached the code
that bridges SSL and SMTP.  You need to load SSL from the Universes browser,
then file in this code.  Then you can connect with something like:

client := SMTPClient openOnSSLHostNamed: 'smtp.gmail.com' port: 995.
client user: '[hidden email]'; password: 'mypassword';
    login;
    initiateSession.
client mailFrom: '[hidden email]';
    recipient: '[hidden email]';
    data: 'Subject: This is a test
From: [hidden email]
To: [hidden email]

Hi.
Bye.
Richard'.
client quit.


good luck!
Rob

----- Original Message -----
From: "Richard Eng" <[hidden email]>
To: "The general-purpose Squeak developers list"
<[hidden email]>
Sent: Wednesday, December 12, 2007 8:14 PM
Subject: Re: SMTPClient and SSL


> Unfortunately, I'm a Smalltalk newbie. (After 5 months, I still don't feel
> all that knowledgeable.) So I'm the wrong person to tackle something like
> this.
>
> Also, I just barely understand what a socket is.  :-(
>
> Regards,
> Richard
>
> -------
> There is an SSL impl in squeak.  The challenge we face is to get
> SMTPClient
> to run on top of an SSLSocket.   SSLSocket does not implement all of the
> protocol of a Socket.  Also, there is nothing which tells SMTPSocket to
> use
> an SSLSocket instead of a Socket.  You could write a subclass of
> SMTPClient
> called SMTPOverSSLClient and do the right thing connecting and we could
> extend SSLSocket to do the right thing.  I am willing to help.
> Interested?
>
> Rob
>
>
>
>



SMTP-SSL.2.cs (10K) Download Attachment