9.2.2 SstSMTPHeader replacement?

33 views
Skip to first unread message

Joachim Tuchel

unread,
Jul 30, 2020, 6:27:08 AM7/30/20
to VA Smalltalk

In 9.2.2 the class SstSMTPHeader is gone. It is not mentioned in the migration guide.
So do I just paste my headers into the message text before using SstSmtpClient>>#sendMail:from:to:

Joachim

Seth Berman

unread,
Jul 30, 2020, 8:00:27 AM7/30/20
to VA Smalltalk
Hello Joachim,

You are correct, it is not explicitly mentioned in the migration guide.
That's because those frameworks (smtp and imap) were replaced with new ones with different abstractions.
They are not based on the old ones, that's why we still ship the old (renamed to SstSMTPCommunicationsObsolete).
in case you still need it.

"So do I just paste my headers into the message text before using SstSmtpClient>>#sendMail:from:to:"
- Yes.  If you have not done so already, have a look at the SstSmtpClientExample class and run through
the examples

- Seth

Joachim Tuchel

unread,
Jul 30, 2020, 8:11:34 AM7/30/20
to VA Smalltalk
In my attempt to migrate SMTP messaging to 9.2.2, I am looking for a class that collects headers and contents and finally reformats that to the String that is sent using SMTP (headers, two or more CR, then the message text).
For a moment I thought SstSmtpMailMessage is what I need. But I am not so sure any more after a few failed attempts.

2 things that make me wonder:

  •  SstSmtpClient>>#sendMail:from:to: only accepts a String as first parameter, and throws an error whan you hand in an SstSmtpMailmessage
  • There seems to be no method in the whole Hierarchy of SstSmtpMailMessage hierarchy where the headers and contents are concatenated
So I guess this is not the place to look at....?

I'd like to simply do something like:

|msg headers|
headers := LookupTable new.
headers at: 'from' put: 'jtu...@test.com'; at: 'Return-Path' put: ...
msg := MYWantedClass new.
msg headers: headers.
msg contents: 'Hi Seth and team,
I really love VAST 9.2.2. so far. Good job. Migration was smooth .. until I tried to send mails.
Regards,

Joachim'.

(SstSmtpClient forUrl: bla)
 startup;
  ehlo: 'something';
  login; 'secret';
  sendMail: msg from: 'jtuchel' to: 'support@instantiations' ;
  logout.


But I seem to be looking for something that's not there...?

Joachim

Joachim Tuchel

unread,
Jul 30, 2020, 8:20:35 AM7/30/20
to VA Smalltalk
Okay, I am one step further:

I can use SstSmtpMailMessage header: headers contents: mailtext to create such a message object.
But handing it into SstSmtpClient>>#sendMail:from:to: ends with:

SstSmtpMailMessage does not understand sstAsSmtpCompatibleString.


So am I using the wrong object here or is this method missing? It is only implemented on String and ByteArray, so I guess I am on the wrong track...

Joachim

Seth Berman

unread,
Jul 30, 2020, 8:36:31 AM7/30/20
to VA Smalltalk
Hi Joachim,

Not sure if you saw my last post...but see SstSmtpClientExample class.
You don't need to do ehlo..it does it for you including helo fallback.

Here is an example to follow:

mail := String new writeStream
nextPutAll: ('From: <%1>' bindWith: 'fr...@email.com'); cr;
nextPutAll: ('To: <%1>' bindWith: 't...@email.com'); cr;
nextPutAll: ('Subject: %1' bindWith: 'Email Subject'); cr; cr;
nextPutAll: 'Message content'; cr;
contents.
(SstSmtpClient forUrl: url)
login: user -> pass;
sendMail: mail from: 'fr...@email.com' to: 't...@email.com';
logout

Joachim Tuchel

unread,
Jul 30, 2020, 8:43:40 AM7/30/20
to VA Smalltalk
Seth,

seems we wrote in parallel.
So SstSmtpMailMessage is not what I'm looking for although it looks very much like it....

Thanks for your time and patience

Joachim

Seth Berman

unread,
Jul 30, 2020, 9:25:58 AM7/30/20
to VA Smalltalk
Hi Joachim,

Sure, no problem.
Have a good one.

- Seth
Reply all
Reply to author
Forward
0 new messages