I
can't seem to get:
SMTPClient example
to
work.
I changed the 'deliverMailFrom:', 'to:' and
'usingServer:' arguments to valid entries but I keep getting a
'TelnetProtocolError'.
Could someone else please test this out cos I think it's broken.
Please prove me wrong ;-)
I'm
using:
Pharo-1.1.1--
Latest update: #11414 on
Windows XP Pro SP3.
Dan
|
It works for me... I changed the from, to, and the smtp server.
What does the error say? Maybe your smpt server requires you to authenticate? Cheers, Adrian On Nov 29, 2010, at 01:28 , Daniel Klein wrote: > I can't seem to get: > > SMTPClient example > > to work. > > I changed the 'deliverMailFrom:', 'to:' and 'usingServer:' arguments to > valid entries but I keep getting a 'TelnetProtocolError'. > > Could someone else please test this out cos I think it's broken. Please > prove me wrong ;-) > > I'm using: > > Pharo-1.1.1-- > Latest update: #11414 > > on Windows XP Pro SP3. > > Dan > > |
Yes, my smtp server requires authentication, but I see nothing in Pharo that
allows me to enter a password like it does for "POP3Client example". Dan -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Adrian Lienhard Sent: Monday, November 29, 2010 4:54 To: A friendly place where any question about pharo is welcome Subject: Re: [Pharo-users] SMTPClient issue It works for me... I changed the from, to, and the smtp server. What does the error say? Maybe your smpt server requires you to authenticate? Cheers, Adrian On Nov 29, 2010, at 01:28 , Daniel Klein wrote: > I can't seem to get: > > SMTPClient example > > to work. > > I changed the 'deliverMailFrom:', 'to:' and 'usingServer:' arguments to > valid entries but I keep getting a 'TelnetProtocolError'. > > Could someone else please test this out cos I think it's broken. Please > prove me wrong ;-) > > I'm using: > > Pharo-1.1.1-- > Latest update: #11414 > > on Windows XP Pro SP3. > > Dan > > |
Hi Dan,
Authentication seems supported. You can send messages #user: and #password: to a SMTPClient instance. The methods are defined in the indirect superclass ProtocolClient. Something along the lines of smtpClient := SMPTClient openOnHostNamed: serverName. smtpClient user: 'login'; password: 'secret'. [ smtpClient initiateSession. smtpClient mailFrom: fromAddress to: recipientList text: messageText. smtpClient quit ] ensure: [smtpClient close] should work (not tested). HTH, Adrian BTW, when you manage to make it work and would like to help a bit, please write a short instruction that we can put into the class SMTPClient or the help system so that others have a faster start. On Nov 29, 2010, at 12:35 , Daniel Klein wrote: > Yes, my smtp server requires authentication, but I see nothing in Pharo that > allows me to enter a password like it does for > "POP3Client example". > > Dan > > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Adrian > Lienhard > Sent: Monday, November 29, 2010 4:54 > To: A friendly place where any question about pharo is welcome > Subject: Re: [Pharo-users] SMTPClient issue > > It works for me... I changed the from, to, and the smtp server. > > What does the error say? Maybe your smpt server requires you to > authenticate? > > Cheers, > Adrian > > > On Nov 29, 2010, at 01:28 , Daniel Klein wrote: > >> I can't seem to get: >> >> SMTPClient example >> >> to work. >> >> I changed the 'deliverMailFrom:', 'to:' and 'usingServer:' arguments to >> valid entries but I keep getting a 'TelnetProtocolError'. >> >> Could someone else please test this out cos I think it's broken. Please >> prove me wrong ;-) >> >> I'm using: >> >> Pharo-1.1.1-- >> Latest update: #11414 >> >> on Windows XP Pro SP3. >> >> Dan >> >> > > > |
I'd be happy to write up instructions for the class, but I have not been
able to get it working at all. And I've spent a considerable amount of time on it. The main requirement I have, different from SMTPClient class>>example, is that my smtp server requires authentication. Here is my best attempt based on Adrian's code below (the names have been changed to protect the innocent ;-) ... | smtpClient serverName login password messageText fromAddress recipientList | serverName := 'smtp.server.name'. login := 'login'. password := 'password'. messageText := 'From: [hidden email] To: "[hidden email]" Subject: this is a test Hello from Pharo!'. fromAddress := '[hidden email]'. recipientList := #('[hidden email]'). smtpClient := SMTPClient openOnHostNamed: serverName. smtpClient user: login. smtpClient password: password. [smtpClient initiateSession. smtpClient mailFrom: fromAddress to: recipientList text: messageText. smtpClient quit. ] ensure: [smtpClient close] When I run this code, I get a 'TelnetProtocolError'. I even tried changing SMPTClient>>deliverMailFrom: by adding in the 'user:' and 'password:' methods, and then re-testing 'SMTPClient example'... deliverMailFrom: fromAddress to: recipientList text: messageText usingServer: serverName | smtpClient | smtpClient := self openOnHostNamed: serverName. smtpClient user: 'login'. "Added this and the next line with valid credentials" smtpClient password: 'password'. [smtpClient initiateSession. smtpClient mailFrom: fromAddress to: recipientList text: messageText. smtpClient quit] ensure: [smtpClient close] but I get the same error. Just for kicks, and to prove my credentials are correct, I put together this script in Python, using the same credentials, and I get a successful email sent. import sys, smtplib, time mailserver = 'smtp.server.name' From = '[hidden email]' To = '[hidden email]' Subj = 'test message' date = time.ctime(time.time()) text = ('From: %s\nTo: %s\nDate: %s\nSubject: %s\n\n' % (From, To, date, Subj)) text = text + 'this is a one line message from python' print 'Connecting...' server = smtplib.SMTP(mailserver) server.login('login','password') server.sendmail(From, To, text) server.quit() So there is either a bug in the authentication aspect in Pharo or (more likely) I'm missing something. There are a very limited number of methods in then SMTPClient inheritance tree that can be used for this, and I've tried a bunch of combinations. Can anyone out there in Pharo-land test SMTPClient against a server that requires authentication? I'd really like to be able to send notifications via email. I've certainly put in my best effort to get it working. Thanks, Dan -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Adrian Lienhard Sent: Tuesday, November 30, 2010 15:46 To: A friendly place where any question about pharo is welcome Subject: Re: [Pharo-users] SMTPClient issue Hi Dan, Authentication seems supported. You can send messages #user: and #password: to a SMTPClient instance. The methods are defined in the indirect superclass ProtocolClient. Something along the lines of smtpClient := SMPTClient openOnHostNamed: serverName. smtpClient user: 'login'; password: 'secret'. [ smtpClient initiateSession. smtpClient mailFrom: fromAddress to: recipientList text: messageText. smtpClient quit ] ensure: [smtpClient close] should work (not tested). HTH, Adrian BTW, when you manage to make it work and would like to help a bit, please write a short instruction that we can put into the class SMTPClient or the help system so that others have a faster start. On Nov 29, 2010, at 12:35 , Daniel Klein wrote: > Yes, my smtp server requires authentication, but I see nothing in Pharo that > allows me to enter a password like it does for > "POP3Client example". > > Dan > > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Adrian > Lienhard > Sent: Monday, November 29, 2010 4:54 > To: A friendly place where any question about pharo is welcome > Subject: Re: [Pharo-users] SMTPClient issue > > It works for me... I changed the from, to, and the smtp server. > > What does the error say? Maybe your smpt server requires you to > authenticate? > > Cheers, > Adrian > > > On Nov 29, 2010, at 01:28 , Daniel Klein wrote: > >> I can't seem to get: >> >> SMTPClient example >> >> to work. >> >> I changed the 'deliverMailFrom:', 'to:' and 'usingServer:' arguments to >> valid entries but I keep getting a 'TelnetProtocolError'. >> >> Could someone else please test this out cos I think it's broken. Please >> prove me wrong ;-) >> >> I'm using: >> >> Pharo-1.1.1-- >> Latest update: #11414 >> >> on Windows XP Pro SP3. >> >> Dan >> >> > > > |
Maybe this will help: I have successfully used Seaside's
WAEmailMessage>>send. Here's what is does -- looks like username/password is supported. Here's the code it executes: seasideDeliverEmailMessage: aWAEmailMessage | client server serverAddress | client := SMTPClient new. "user login information if applicable" self seasideSmtpUsername ifNotNilDo: [ :username | client user: username. self seasideSmtpPassword ifNotNilDo: [ :password | client password: password ] ]. "use HELO/EHLO ip address format [127.0.0.1] if local host name is ip" (self isIpAddress: client localHostName) ifTrue: [ client localHostName: '[', client localHostName, ']' ]. "deliver the mail" server := self seasideSmtpServer. serverAddress := (self isIpAddress: server) ifTrue: [ server ] ifFalse: [ NetNameResolver addressForName: server ]. client openOnHost: serverAddress port: self seasideSmtpPort. [client mailFrom: aWAEmailMessage from greaseString to: aWAEmailMessage recipientsAddresses text: aWAEmailMessage plainMessage. client quit ] ensure: [ client close ] On Sun, Dec 5, 2010 at 5:32 PM, Daniel Klein <[hidden email]> wrote: > I'd be happy to write up instructions for the class, but I have not been > able to get it working at all. And I've spent a considerable amount of time > on it. The main requirement I have, different from SMTPClient > class>>example, is that my smtp server requires authentication. > > Here is my best attempt based on Adrian's code below (the names have been > changed to protect the innocent ;-) ... > > | smtpClient serverName login password messageText fromAddress recipientList > | > serverName := 'smtp.server.name'. > login := 'login'. > password := 'password'. > messageText := > 'From: [hidden email] > To: "[hidden email]" > Subject: this is a test > > Hello from Pharo!'. > > fromAddress := '[hidden email]'. > recipientList := #('[hidden email]'). > smtpClient := SMTPClient openOnHostNamed: serverName. > smtpClient user: login. > smtpClient password: password. > [smtpClient initiateSession. > smtpClient mailFrom: fromAddress to: recipientList text: messageText. > smtpClient quit. > ] ensure: [smtpClient close] > > > When I run this code, I get a 'TelnetProtocolError'. > > I even tried changing SMPTClient>>deliverMailFrom: by adding in the 'user:' > and 'password:' methods, and then re-testing 'SMTPClient example'... > > deliverMailFrom: fromAddress to: recipientList text: messageText > usingServer: serverName > | smtpClient | > smtpClient := self openOnHostNamed: serverName. > smtpClient user: 'login'. "Added this and the next line with valid > credentials" > smtpClient password: 'password'. > [smtpClient initiateSession. > smtpClient mailFrom: fromAddress to: recipientList text: > messageText. > smtpClient quit] > ensure: [smtpClient close] > > but I get the same error. > > Just for kicks, and to prove my credentials are correct, I put together this > script in Python, using the same credentials, and I get a successful email > sent. > > import sys, smtplib, time > mailserver = 'smtp.server.name' > From = '[hidden email]' > To = '[hidden email]' > Subj = 'test message' > date = time.ctime(time.time()) > text = ('From: %s\nTo: %s\nDate: %s\nSubject: %s\n\n' % (From, To, date, > Subj)) > text = text + 'this is a one line message from python' > print 'Connecting...' > server = smtplib.SMTP(mailserver) > server.login('login','password') > server.sendmail(From, To, text) > server.quit() > > So there is either a bug in the authentication aspect in Pharo or (more > likely) I'm missing something. > > There are a very limited number of methods in then SMTPClient inheritance > tree that can be used for this, and I've tried a bunch of combinations. > > Can anyone out there in Pharo-land test SMTPClient against a server that > requires authentication? I'd really like to be able to send notifications > via email. I've certainly put in my best effort to get it working. > > Thanks, > Dan > > > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Adrian > Lienhard > Sent: Tuesday, November 30, 2010 15:46 > To: A friendly place where any question about pharo is welcome > Subject: Re: [Pharo-users] SMTPClient issue > > Hi Dan, > > Authentication seems supported. You can send messages #user: and #password: > to a SMTPClient instance. The methods are defined in the indirect superclass > ProtocolClient. > > Something along the lines of > > smtpClient := SMPTClient openOnHostNamed: serverName. > smtpClient user: 'login'; password: 'secret'. > [ smtpClient initiateSession. > smtpClient mailFrom: fromAddress to: recipientList text: > messageText. > smtpClient quit > ] ensure: [smtpClient close] > > should work (not tested). > > HTH, > Adrian > > BTW, when you manage to make it work and would like to help a bit, please > write a short instruction that we can put into the class SMTPClient or the > help system so that others have a faster start. > > > On Nov 29, 2010, at 12:35 , Daniel Klein wrote: > >> Yes, my smtp server requires authentication, but I see nothing in Pharo > that >> allows me to enter a password like it does for >> "POP3Client example". >> >> Dan >> >> -----Original Message----- >> From: [hidden email] >> [mailto:[hidden email]] On Behalf Of Adrian >> Lienhard >> Sent: Monday, November 29, 2010 4:54 >> To: A friendly place where any question about pharo is welcome >> Subject: Re: [Pharo-users] SMTPClient issue >> >> It works for me... I changed the from, to, and the smtp server. >> >> What does the error say? Maybe your smpt server requires you to >> authenticate? >> >> Cheers, >> Adrian >> >> >> On Nov 29, 2010, at 01:28 , Daniel Klein wrote: >> >>> I can't seem to get: >>> >>> SMTPClient example >>> >>> to work. >>> >>> I changed the 'deliverMailFrom:', 'to:' and 'usingServer:' arguments to >>> valid entries but I keep getting a 'TelnetProtocolError'. >>> >>> Could someone else please test this out cos I think it's broken. Please >>> prove me wrong ;-) >>> >>> I'm using: >>> >>> Pharo-1.1.1-- >>> Latest update: #11414 >>> >>> on Windows XP Pro SP3. >>> >>> Dan >>> >>> >> >> >> > > > > |
Free forum by Nabble | Edit this page |