[Pharo-project] ZdcSecurePOP3Client and ZdcSecureSMTPClient
This week I found some time to finish two small examples, ZdcSecurePOP3Client and ZdcSecureSMTPClient. These are subclasses from the POP3Client and SMTPClient already present, but open a ZdcSecureSocketStream to the POP3/SMTP server and connect it at the SSL level. This means you can now receive and/or send email securely over SSL, to GMail for example: "Retrieve (but not delete) your last 5 messages" ZdcSecurePOP3Client retrieveMessagesFromGMailAccount: '<your-name>@gmail.com' password: '<your-password>' limit: 5. (Note that you have to enable POP3 access in your GMail account) "Send a message" | mailMessage | mailMessage := MailMessage empty. mailMessage setField: 'subject' toString: 'ZdcSecureSMTPClient Test'. mailMessage body: (MIMEDocument contentType: 'text/plain' content: 'This is test from Pharo Smalltalk'). ZdcSecureSMTPClient sendUsingGMailAccount: '<your-name>@gmail.com' password: '<your-password>' to: '<email-address>' message: mailMessage The code is in the 'Zodiac-Extra' package in the http://www.squeaksource.com/Zodiac repository. Of course, you also have to install Zodiac and a plugin, see http://zdc.stfx.eu/ for more details. Sven
Great!! That's fantastic! I didn't try, yet. Does it support STARTTLS as well? Norbert Am 08.12.2011 um 12:27 schrieb Sven Van Caekenberghe:
This week I found some time to finish two small examples, ZdcSecurePOP3Client and ZdcSecureSMTPClient. These are subclasses from the POP3Client and SMTPClient already present, but open a ZdcSecureSocketStream to the POP3/SMTP server and connect it at the SSL level. This means you can now receive and/or send email securely over SSL, to GMail for example:
"Retrieve (but not delete) your last 5 messages"
ZdcSecurePOP3Client retrieveMessagesFromGMailAccount: '<your-name>@gmail.com' password: '<your-password>' limit: 5.
(Note that you have to enable POP3 access in your GMail account)
"Send a message"
| mailMessage | mailMessage := MailMessage empty. mailMessage setField: 'subject' toString: 'ZdcSecureSMTPClient Test'. mailMessage body: (MIMEDocument contentType: 'text/plain' content: 'This is test from Pharo Smalltalk'). ZdcSecureSMTPClient sendUsingGMailAccount: '<your-name>@gmail.com' password: '<your-password>' to: '<email-address>' message: mailMessage
The code is in the 'Zodiac-Extra' package in the http://www.squeaksource.com/Zodiac repository. Of course, you also have to install Zodiac and a plugin, see http://zdc.stfx.eu/ for more details.
Sven
Norbert, On 08 Dec 2011, at 12:47, Norbert Hartl wrote:
I didn't try, yet. Does it support STARTTLS as well?
Yes, it should: the code is there, but I did not test it recently. The default is plain SSL though. Check out the #useStartTLS initialization method. The core protocol is in #setupStreamForStartTLS. To debug, best uncomment the logging code in #logVerbose and open your Transcript. Let me know how it goes. Sven
I loved such kind of mails :) thanks thanks thanks STef On Dec 8, 2011, at 12:27 PM, Sven Van Caekenberghe wrote:
This week I found some time to finish two small examples, ZdcSecurePOP3Client and ZdcSecureSMTPClient. These are subclasses from the POP3Client and SMTPClient already present, but open a ZdcSecureSocketStream to the POP3/SMTP server and connect it at the SSL level. This means you can now receive and/or send email securely over SSL, to GMail for example:
"Retrieve (but not delete) your last 5 messages"
ZdcSecurePOP3Client retrieveMessagesFromGMailAccount: '<your-name>@gmail.com' password: '<your-password>' limit: 5.
(Note that you have to enable POP3 access in your GMail account)
"Send a message"
| mailMessage | mailMessage := MailMessage empty. mailMessage setField: 'subject' toString: 'ZdcSecureSMTPClient Test'. mailMessage body: (MIMEDocument contentType: 'text/plain' content: 'This is test from Pharo Smalltalk'). ZdcSecureSMTPClient sendUsingGMailAccount: '<your-name>@gmail.com' password: '<your-password>' to: '<email-address>' message: mailMessage
The code is in the 'Zodiac-Extra' package in the http://www.squeaksource.com/Zodiac repository. Of course, you also have to install Zodiac and a plugin, see http://zdc.stfx.eu/ for more details.
Sven
participants (3)
-
Norbert Hartl -
Stéphane Ducasse -
Sven Van Caekenberghe