Using VAST SMTP EMail framework

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

Using VAST SMTP EMail framework

rjuli...@gmail.com
Hello....

I am starting to switch over from using EMan to using the VAST SMTP EMail framework,
and it appears to be very powerful and easy to use.  I have already proven it works
in situations that EMan was never able to handle.

I have already added my own framework around it, to permit sending HTML, and using
blind carbon copy.

I would like to add the ability to include attachments as well.

I know this is generally just a matter of adding the appropriate headers,
and I do not expect to have any problems doing that.
But before I reinvent the wheel, I thought I'd ask if anyone else has already
done that.

I am specifically looking to use SMTP.

Any assistance is greatly appreciated....

Best Regards,
Julian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/96090a5c-15ad-4589-8d96-31e12357c3eco%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

Adriaan van Os-3
We used to use TobSockets (http://www.totallyobjects.com/Sockset.htm) for composing and sending mails with attachments. Now we use the smtp classes from 9.2.0 and some fixes from 9.2.1 to send mails. We still compose the (multipart) mail bodies with the code from TobSockets.

Hope this helps.
Adriaan.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/b6c71bc8-3cbe-48d6-898e-fa87f93bdd22o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

rjuli...@gmail.com
Thanks, Adriaan.

I have also used TobSockets before.

I appreciate the reply....

Regards,
Julian

On Thursday, June 11, 2020 at 3:46:24 PM UTC-4, Adriaan van Os wrote:
We used to use TobSockets (<a href="http://www.totallyobjects.com/Sockset.htm" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.totallyobjects.com%2FSockset.htm\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF3OcspcatR9SG7sZiEdQInKW2OGQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.totallyobjects.com%2FSockset.htm\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF3OcspcatR9SG7sZiEdQInKW2OGQ&#39;;return true;">http://www.totallyobjects.com/Sockset.htm) for composing and sending mails with attachments. Now we use the smtp classes from 9.2.0 and some fixes from 9.2.1 to send mails. We still compose the (multipart) mail bodies with the code from TobSockets.

Hope this helps.
Adriaan.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/23d5e0fb-36ab-48cb-b5c9-73332764fdf3o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

jtuchel
In reply to this post by rjuli...@gmail.com
Julian,

VAST 9.2 indeed makes SMTP and IMAP so easy and has a wonderful API compared to the "swamp" we had in SST before that. Instantiations is making such great progress on so many edges of VAST. I am about to help a customer migrate from VAST 6.02 and am eager to see both their eyes when they touch 9.2.2. for the first time and the flash from the past when I touch 6.02 again ;-)


I did something that comes close to a port of MIMEMailApp from Pharo 6 or seven a bit more than a year ago. It is far from providing a nice API for assembling and parsing mail messages, but it is a start. I also fixed a few things that didn't work in te original implementation and removed some Pharo specific classes/prerequisites. At the sime time I introduced some dependencies from Seaside/Grease, e.g. for MIME types, so this is not something that will work out of the box. It does send a few dozen mixed html/plain text mails with attachments every day in our Kontolino servers, so I guess it is a good starting point.

It's not code I am proud of, nor is the API very good so I don't think this is what assembling mail messages in VAST should look like in the future. But it is a starting point. I didn't dare pushing it to VASTGooedies, so I am attaching it here.


I hope it helps. Please let me know if you find errors. Maybe this could be one of the early additions to the new Community hub on Github ?

Joachim


P.S.: I'd be interested to learn about your carbon copy / blind carbon copy stuff. Are you extracting these infos from the mail's headers and copy automagically?

P.S.: I am looking for reliable ways of finding out whether a mail reached its recipient, or better: to find out which original message an "undelivered" mail belongs to. We need to know who didn't receive their invoices, for example. So if you have links, book or article suggestions, please feel free to share...


Am Donnerstag, 11. Juni 2020 19:28:57 UTC+2 schrieb Julian Ford:
Hello....

I am starting to switch over from using EMan to using the VAST SMTP EMail framework,
and it appears to be very powerful and easy to use.  I have already proven it works
in situations that EMan was never able to handle.

I have already added my own framework around it, to permit sending HTML, and using
blind carbon copy.

I would like to add the ability to include attachments as well.

I know this is generally just a matter of adding the appropriate headers,
and I do not expect to have any problems doing that.
But before I reinvent the wheel, I thought I'd ask if anyone else has already
done that.

I am specifically looking to use SMTP.

Any assistance is greatly appreciated....

Best Regards,
Julian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/3486d7c3-fe9d-41c6-b543-aa6e29cb5427o%40googlegroups.com.

MIMEMailApp.app (34K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

rjuli...@gmail.com
Hello, Joachim.

Nice to hear from you...
I think of those days drinking Mirto in Sardenia quite a bit, lately!!!

I greatly appreciate you taking the time to respond, and send me your code.
As it happens, I actually completed my own solution last night.
I can now create an EMail, set it as HTML or not, attach any number of files,
choose whether the EMail should be base64 encoded or not,
and select both CC and BCC options.

So....thank you!!  I'm afraid I just ended up finishing quicker than I expected.
You are right...this new framework is really nice.

As for the CC and BCC stuff....
First of all it is critical to keep any BCC information out of the headers.
I learned that the hard way, some years ago, when I discovered that GMAIL
can show all of the headers...and thereby display the BCC list.

So, my solution, is that I have a bcc and cc instance variables in my EMailMessage
class (names simplified for illustration).
When I format the headers, to send at the DATA step, I do the following:

( self carbonCopy notNilOrEmpty ) ifTrue: [
aStream nextPutAll: 'cc: '.
self carbonCopy doWithIndex: [ :address :index |
( index > 1 ) ifTrue: [ aStream nextPutAll: '; ' ].
aStream nextPutAll: address.
].
aStream cr.
].

I do not add anything to do with the bcc list into this DATA step.

Then, when I actually send the message, I use the following:

sstSmtpClient sendMail: (anEMailMessage formattedMessage) from: self senderName to: anEMailMessage allRecipients

where #allRecipients is

| list |
list := OrderedCollection new.

( self recipientAddress notNilOrBlankString ) ifTrue: [ list add: self recipientAddress ].

( self carbonCopy notNilOrEmpty ) ifTrue: [ list addAll: self carbonCopy ].
( self blindCopy notNilOrEmpty ) ifTrue: [ list addAll: self blindCopy ].

^list

I hope you find that useful!

Thanks again!!!!

Julian






On Friday, June 12, 2020 at 12:12:46 AM UTC-4, Joachim Tuchel wrote:
Julian,

VAST 9.2 indeed makes SMTP and IMAP so easy and has a wonderful API compared to the "swamp" we had in SST before that. Instantiations is making such great progress on so many edges of VAST. I am about to help a customer migrate from VAST 6.02 and am eager to see both their eyes when they touch 9.2.2. for the first time and the flash from the past when I touch 6.02 again ;-)


I did something that comes close to a port of MIMEMailApp from Pharo 6 or seven a bit more than a year ago. It is far from providing a nice API for assembling and parsing mail messages, but it is a start. I also fixed a few things that didn't work in te original implementation and removed some Pharo specific classes/prerequisites. At the sime time I introduced some dependencies from Seaside/Grease, e.g. for MIME types, so this is not something that will work out of the box. It does send a few dozen mixed html/plain text mails with attachments every day in our Kontolino servers, so I guess it is a good starting point.

It's not code I am proud of, nor is the API very good so I don't think this is what assembling mail messages in VAST should look like in the future. But it is a starting point. I didn't dare pushing it to VASTGooedies, so I am attaching it here.


I hope it helps. Please let me know if you find errors. Maybe this could be one of the early additions to the new Community hub on Github ?

Joachim


P.S.: I'd be interested to learn about your carbon copy / blind carbon copy stuff. Are you extracting these infos from the mail's headers and copy automagically?

P.S.: I am looking for reliable ways of finding out whether a mail reached its recipient, or better: to find out which original message an "undelivered" mail belongs to. We need to know who didn't receive their invoices, for example. So if you have links, book or article suggestions, please feel free to share...


Am Donnerstag, 11. Juni 2020 19:28:57 UTC+2 schrieb Julian Ford:
Hello....

I am starting to switch over from using EMan to using the VAST SMTP EMail framework,
and it appears to be very powerful and easy to use.  I have already proven it works
in situations that EMan was never able to handle.

I have already added my own framework around it, to permit sending HTML, and using
blind carbon copy.

I would like to add the ability to include attachments as well.

I know this is generally just a matter of adding the appropriate headers,
and I do not expect to have any problems doing that.
But before I reinvent the wheel, I thought I'd ask if anyone else has already
done that.

I am specifically looking to use SMTP.

Any assistance is greatly appreciated....

Best Regards,
Julian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

Mariano Martinez Peck-2
Hi guys,

It's great to see everybody helping each other. Now:

* Adriaan said they use TobSockets to compose multipart. 
* Joachim said he uses a port of MIMEMailApp
* Julian just finished his own solution

I noticed Joachim quote "Maybe this could be one of the early additions to the new Community hub on Github ?" and I couldn't agree more :)
I think it would be a nice addition and we can also document the project (add some example, some documentation, etc.). If you give me an ENVY dat file and some instructions to test it, then I can help with the Tonel export and I can submit a first draft into Github. 

Best, 


On Fri, Jun 12, 2020 at 3:07 PM Julian Ford <[hidden email]> wrote:
Hello, Joachim.

Nice to hear from you...
I think of those days drinking Mirto in Sardenia quite a bit, lately!!!

I greatly appreciate you taking the time to respond, and send me your code.
As it happens, I actually completed my own solution last night.
I can now create an EMail, set it as HTML or not, attach any number of files,
choose whether the EMail should be base64 encoded or not,
and select both CC and BCC options.

So....thank you!!  I'm afraid I just ended up finishing quicker than I expected.
You are right...this new framework is really nice.

As for the CC and BCC stuff....
First of all it is critical to keep any BCC information out of the headers.
I learned that the hard way, some years ago, when I discovered that GMAIL
can show all of the headers...and thereby display the BCC list.

So, my solution, is that I have a bcc and cc instance variables in my EMailMessage
class (names simplified for illustration).
When I format the headers, to send at the DATA step, I do the following:

( self carbonCopy notNilOrEmpty ) ifTrue: [
aStream nextPutAll: 'cc: '.
self carbonCopy doWithIndex: [ :address :index |
( index > 1 ) ifTrue: [ aStream nextPutAll: '; ' ].
aStream nextPutAll: address.
].
aStream cr.
].

I do not add anything to do with the bcc list into this DATA step.

Then, when I actually send the message, I use the following:

sstSmtpClient sendMail: (anEMailMessage formattedMessage) from: self senderName to: anEMailMessage allRecipients

where #allRecipients is

| list |
list := OrderedCollection new.

( self recipientAddress notNilOrBlankString ) ifTrue: [ list add: self recipientAddress ].

( self carbonCopy notNilOrEmpty ) ifTrue: [ list addAll: self carbonCopy ].
( self blindCopy notNilOrEmpty ) ifTrue: [ list addAll: self blindCopy ].

^list

I hope you find that useful!

Thanks again!!!!

Julian






On Friday, June 12, 2020 at 12:12:46 AM UTC-4, Joachim Tuchel wrote:
Julian,

VAST 9.2 indeed makes SMTP and IMAP so easy and has a wonderful API compared to the "swamp" we had in SST before that. Instantiations is making such great progress on so many edges of VAST. I am about to help a customer migrate from VAST 6.02 and am eager to see both their eyes when they touch 9.2.2. for the first time and the flash from the past when I touch 6.02 again ;-)


I did something that comes close to a port of MIMEMailApp from Pharo 6 or seven a bit more than a year ago. It is far from providing a nice API for assembling and parsing mail messages, but it is a start. I also fixed a few things that didn't work in te original implementation and removed some Pharo specific classes/prerequisites. At the sime time I introduced some dependencies from Seaside/Grease, e.g. for MIME types, so this is not something that will work out of the box. It does send a few dozen mixed html/plain text mails with attachments every day in our Kontolino servers, so I guess it is a good starting point.

It's not code I am proud of, nor is the API very good so I don't think this is what assembling mail messages in VAST should look like in the future. But it is a starting point. I didn't dare pushing it to VASTGooedies, so I am attaching it here.


I hope it helps. Please let me know if you find errors. Maybe this could be one of the early additions to the new Community hub on Github ?

Joachim


P.S.: I'd be interested to learn about your carbon copy / blind carbon copy stuff. Are you extracting these infos from the mail's headers and copy automagically?

P.S.: I am looking for reliable ways of finding out whether a mail reached its recipient, or better: to find out which original message an "undelivered" mail belongs to. We need to know who didn't receive their invoices, for example. So if you have links, book or article suggestions, please feel free to share...


Am Donnerstag, 11. Juni 2020 19:28:57 UTC+2 schrieb Julian Ford:
Hello....

I am starting to switch over from using EMan to using the VAST SMTP EMail framework,
and it appears to be very powerful and easy to use.  I have already proven it works
in situations that EMan was never able to handle.

I have already added my own framework around it, to permit sending HTML, and using
blind carbon copy.

I would like to add the ability to include attachments as well.

I know this is generally just a matter of adding the appropriate headers,
and I do not expect to have any problems doing that.
But before I reinvent the wheel, I thought I'd ask if anyone else has already
done that.

I am specifically looking to use SMTP.

Any assistance is greatly appreciated....

Best Regards,
Julian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com.


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAOUkibGiTbsRFEAeuVv0C4YF-mt6LoQLX_%2B-7OrpMbjsJaVzSQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

Richard Sargent
Administrator
In reply to this post by rjuli...@gmail.com
On Friday, June 12, 2020 at 11:07:14 AM UTC-7, Julian Ford wrote:
Hello, Joachim.

Nice to hear from you...
I think of those days drinking Mirto in Sardenia quite a bit, lately!!!

I greatly appreciate you taking the time to respond, and send me your code.
As it happens, I actually completed my own solution last night.
I can now create an EMail, set it as HTML or not, attach any number of files,
choose whether the EMail should be base64 encoded or not,
and select both CC and BCC options.

So....thank you!!  I'm afraid I just ended up finishing quicker than I expected.
You are right...this new framework is really nice.

As for the CC and BCC stuff....
First of all it is critical to keep any BCC information out of the headers.
I learned that the hard way, some years ago, when I discovered that GMAIL
can show all of the headers...and thereby display the BCC list.

So, my solution, is that I have a bcc and cc instance variables in my EMailMessage
class (names simplified for illustration).
When I format the headers, to send at the DATA step, I do the following:

( self carbonCopy notNilOrEmpty ) ifTrue: [
aStream nextPutAll: 'cc: '.
self carbonCopy doWithIndex: [ :address :index |
( index > 1 ) ifTrue: [ aStream nextPutAll: '; ' ].
aStream nextPutAll: address.
].
aStream cr.
].

I do not add anything to do with the bcc list into this DATA step.

Then, when I actually send the message, I use the following:

sstSmtpClient sendMail: (anEMailMessage formattedMessage) from: self senderName to: anEMailMessage allRecipients

where #allRecipients is

| list |
list := OrderedCollection new.

( self recipientAddress notNilOrBlankString ) ifTrue: [ list add: self recipientAddress ].

( self carbonCopy notNilOrEmpty ) ifTrue: [ list addAll: self carbonCopy ].
( self blindCopy notNilOrEmpty ) ifTrue: [ list addAll: self blindCopy ].

^list

I hope you find that useful!

Hi Julian,

I want to pass on some design thoughts, inspired by a lesson I learned waaay back in '89. Your use case may be sufficiently different that they don't apply, but in general, they will if you go to use the emailing code for another purpose later.

1) Get rid of all the conditional logic.
2) Model the email message protocol not the subset you use today.
3) Test for empty collections only when it matters. (it often doesn't / rarely does)

Specifically, model the existence of 0 or more (primary) recipients, 0 or more carbon copy recipients, and 0 or more blind copy recipients. Don't model a single primary recipient when an email can be addressed to multiple people. The step function from 1 to many is huge, so start with having it right.

And initialize all three collections to an empty collection. Then just use #primaryRecipients, #carbonCopyRecipients, and #blindRecipients knowing they will do exactly what you need. You will find use for a method like #writeHeader:list: convenient for both the To header and the CC header. And probably some others.


Thanks again!!!!

Julian






On Friday, June 12, 2020 at 12:12:46 AM UTC-4, Joachim Tuchel wrote:
Julian,

VAST 9.2 indeed makes SMTP and IMAP so easy and has a wonderful API compared to the "swamp" we had in SST before that. Instantiations is making such great progress on so many edges of VAST. I am about to help a customer migrate from VAST 6.02 and am eager to see both their eyes when they touch 9.2.2. for the first time and the flash from the past when I touch 6.02 again ;-)


I did something that comes close to a port of MIMEMailApp from Pharo 6 or seven a bit more than a year ago. It is far from providing a nice API for assembling and parsing mail messages, but it is a start. I also fixed a few things that didn't work in te original implementation and removed some Pharo specific classes/prerequisites. At the sime time I introduced some dependencies from Seaside/Grease, e.g. for MIME types, so this is not something that will work out of the box. It does send a few dozen mixed html/plain text mails with attachments every day in our Kontolino servers, so I guess it is a good starting point.

It's not code I am proud of, nor is the API very good so I don't think this is what assembling mail messages in VAST should look like in the future. But it is a starting point. I didn't dare pushing it to VASTGooedies, so I am attaching it here.


I hope it helps. Please let me know if you find errors. Maybe this could be one of the early additions to the new Community hub on Github ?

Joachim


P.S.: I'd be interested to learn about your carbon copy / blind carbon copy stuff. Are you extracting these infos from the mail's headers and copy automagically?

P.S.: I am looking for reliable ways of finding out whether a mail reached its recipient, or better: to find out which original message an "undelivered" mail belongs to. We need to know who didn't receive their invoices, for example. So if you have links, book or article suggestions, please feel free to share...


Am Donnerstag, 11. Juni 2020 19:28:57 UTC+2 schrieb Julian Ford:
Hello....

I am starting to switch over from using EMan to using the VAST SMTP EMail framework,
and it appears to be very powerful and easy to use.  I have already proven it works
in situations that EMan was never able to handle.

I have already added my own framework around it, to permit sending HTML, and using
blind carbon copy.

I would like to add the ability to include attachments as well.

I know this is generally just a matter of adding the appropriate headers,
and I do not expect to have any problems doing that.
But before I reinvent the wheel, I thought I'd ask if anyone else has already
done that.

I am specifically looking to use SMTP.

Any assistance is greatly appreciated....

Best Regards,
Julian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/a84ef38f-68ae-43c0-b737-9559c13edbc9o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

Seth Berman
In reply to this post by Mariano Martinez Peck-2
Hi All,

This is really cool work.  I would be willing to jump in and help on this, as well!

- Seth

On Friday, June 12, 2020 at 3:33:50 PM UTC-4 Mariano Martinez Peck wrote:
Hi guys,

It's great to see everybody helping each other. Now:

* Adriaan said they use TobSockets to compose multipart. 
* Joachim said he uses a port of MIMEMailApp
* Julian just finished his own solution

I noticed Joachim quote "Maybe this could be one of the early additions to the new Community hub on Github ?" and I couldn't agree more :)
I think it would be a nice addition and we can also document the project (add some example, some documentation, etc.). If you give me an ENVY dat file and some instructions to test it, then I can help with the Tonel export and I can submit a first draft into Github. 

Best, 


On Fri, Jun 12, 2020 at 3:07 PM Julian Ford <[hidden email]> wrote:
Hello, Joachim.

Nice to hear from you...
I think of those days drinking Mirto in Sardenia quite a bit, lately!!!

I greatly appreciate you taking the time to respond, and send me your code.
As it happens, I actually completed my own solution last night.
I can now create an EMail, set it as HTML or not, attach any number of files,
choose whether the EMail should be base64 encoded or not,
and select both CC and BCC options.

So....thank you!!  I'm afraid I just ended up finishing quicker than I expected.
You are right...this new framework is really nice.

As for the CC and BCC stuff....
First of all it is critical to keep any BCC information out of the headers.
I learned that the hard way, some years ago, when I discovered that GMAIL
can show all of the headers...and thereby display the BCC list.

So, my solution, is that I have a bcc and cc instance variables in my EMailMessage
class (names simplified for illustration).
When I format the headers, to send at the DATA step, I do the following:

( self carbonCopy notNilOrEmpty ) ifTrue: [
aStream nextPutAll: 'cc: '.
self carbonCopy doWithIndex: [ :address :index |
( index > 1 ) ifTrue: [ aStream nextPutAll: '; ' ].
aStream nextPutAll: address.
].
aStream cr.
].

I do not add anything to do with the bcc list into this DATA step.

Then, when I actually send the message, I use the following:

sstSmtpClient sendMail: (anEMailMessage formattedMessage) from: self senderName to: anEMailMessage allRecipients

where #allRecipients is

| list |
list := OrderedCollection new.

( self recipientAddress notNilOrBlankString ) ifTrue: [ list add: self recipientAddress ].

( self carbonCopy notNilOrEmpty ) ifTrue: [ list addAll: self carbonCopy ].
( self blindCopy notNilOrEmpty ) ifTrue: [ list addAll: self blindCopy ].

^list

I hope you find that useful!

Thanks again!!!!

Julian






On Friday, June 12, 2020 at 12:12:46 AM UTC-4, Joachim Tuchel wrote:
Julian,

VAST 9.2 indeed makes SMTP and IMAP so easy and has a wonderful API compared to the "swamp" we had in SST before that. Instantiations is making such great progress on so many edges of VAST. I am about to help a customer migrate from VAST 6.02 and am eager to see both their eyes when they touch 9.2.2. for the first time and the flash from the past when I touch 6.02 again ;-)


I did something that comes close to a port of MIMEMailApp from Pharo 6 or seven a bit more than a year ago. It is far from providing a nice API for assembling and parsing mail messages, but it is a start. I also fixed a few things that didn't work in te original implementation and removed some Pharo specific classes/prerequisites. At the sime time I introduced some dependencies from Seaside/Grease, e.g. for MIME types, so this is not something that will work out of the box. It does send a few dozen mixed html/plain text mails with attachments every day in our Kontolino servers, so I guess it is a good starting point.

It's not code I am proud of, nor is the API very good so I don't think this is what assembling mail messages in VAST should look like in the future. But it is a starting point. I didn't dare pushing it to VASTGooedies, so I am attaching it here.


I hope it helps. Please let me know if you find errors. Maybe this could be one of the early additions to the new Community hub on Github ?

Joachim


P.S.: I'd be interested to learn about your carbon copy / blind carbon copy stuff. Are you extracting these infos from the mail's headers and copy automagically?

P.S.: I am looking for reliable ways of finding out whether a mail reached its recipient, or better: to find out which original message an "undelivered" mail belongs to. We need to know who didn't receive their invoices, for example. So if you have links, book or article suggestions, please feel free to share...


Am Donnerstag, 11. Juni 2020 19:28:57 UTC+2 schrieb Julian Ford:
Hello....

I am starting to switch over from using EMan to using the VAST SMTP EMail framework,
and it appears to be very powerful and easy to use.  I have already proven it works
in situations that EMan was never able to handle.

I have already added my own framework around it, to permit sending HTML, and using
blind carbon copy.

I would like to add the ability to include attachments as well.

I know this is generally just a matter of adding the appropriate headers,
and I do not expect to have any problems doing that.
But before I reinvent the wheel, I thought I'd ask if anyone else has already
done that.

I am specifically looking to use SMTP.

Any assistance is greatly appreciated....

Best Regards,
Julian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com.


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/7452b2c5-6a90-403d-8dd4-15b9670fb267n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

rjuli...@gmail.com
In reply to this post by Richard Sargent
Hello, Richard.

Thank you for the design suggestions.

You are right that I did tend to limit my vision on this to my current need.
For example, there can never be more than one recipient in my domain.

The reason I put in conditional logic, is that I was assuming a CC header must not appear
in the DATA segment, if there is no one being copied.
I agree completely, though, that polymorphic behaviour is far better than using conditional logic.

Mostly, what I have right now, was just a proof of concept.  I have hundreds of users, who are suddenly
trying to use EMail from my application (even though I introduced it about 10 years ago!), because of
the current restrictions.
With that, I had run into a few users, whose authentication required OAUTH, and EMan (which worked
quite well for all of this time) did not support it.  I considered extending EMan, or just finally making
the break, and going with the new VAST SstSmtpClient stuff.

I have everything working now, but will almost certainly spend some time smoothing out the rough edges.

Thanks for taking the time to respond....

Julian


On Friday, June 12, 2020 at 3:38:44 PM UTC-4, Richard Sargent wrote:
On Friday, June 12, 2020 at 11:07:14 AM UTC-7, Julian Ford wrote:
Hello, Joachim.

Nice to hear from you...
I think of those days drinking Mirto in Sardenia quite a bit, lately!!!

I greatly appreciate you taking the time to respond, and send me your code.
As it happens, I actually completed my own solution last night.
I can now create an EMail, set it as HTML or not, attach any number of files,
choose whether the EMail should be base64 encoded or not,
and select both CC and BCC options.

So....thank you!!  I'm afraid I just ended up finishing quicker than I expected.
You are right...this new framework is really nice.

As for the CC and BCC stuff....
First of all it is critical to keep any BCC information out of the headers.
I learned that the hard way, some years ago, when I discovered that GMAIL
can show all of the headers...and thereby display the BCC list.

So, my solution, is that I have a bcc and cc instance variables in my EMailMessage
class (names simplified for illustration).
When I format the headers, to send at the DATA step, I do the following:

( self carbonCopy notNilOrEmpty ) ifTrue: [
aStream nextPutAll: 'cc: '.
self carbonCopy doWithIndex: [ :address :index |
( index > 1 ) ifTrue: [ aStream nextPutAll: '; ' ].
aStream nextPutAll: address.
].
aStream cr.
].

I do not add anything to do with the bcc list into this DATA step.

Then, when I actually send the message, I use the following:

sstSmtpClient sendMail: (anEMailMessage formattedMessage) from: self senderName to: anEMailMessage allRecipients

where #allRecipients is

| list |
list := OrderedCollection new.

( self recipientAddress notNilOrBlankString ) ifTrue: [ list add: self recipientAddress ].

( self carbonCopy notNilOrEmpty ) ifTrue: [ list addAll: self carbonCopy ].
( self blindCopy notNilOrEmpty ) ifTrue: [ list addAll: self blindCopy ].

^list

I hope you find that useful!

Hi Julian,

I want to pass on some design thoughts, inspired by a lesson I learned waaay back in '89. Your use case may be sufficiently different that they don't apply, but in general, they will if you go to use the emailing code for another purpose later.

1) Get rid of all the conditional logic.
2) Model the email message protocol not the subset you use today.
3) Test for empty collections only when it matters. (it often doesn't / rarely does)

Specifically, model the existence of 0 or more (primary) recipients, 0 or more carbon copy recipients, and 0 or more blind copy recipients. Don't model a single primary recipient when an email can be addressed to multiple people. The step function from 1 to many is huge, so start with having it right.

And initialize all three collections to an empty collection. Then just use #primaryRecipients, #carbonCopyRecipients, and #blindRecipients knowing they will do exactly what you need. You will find use for a method like #writeHeader:list: convenient for both the To header and the CC header. And probably some others.


Thanks again!!!!

Julian






On Friday, June 12, 2020 at 12:12:46 AM UTC-4, Joachim Tuchel wrote:
Julian,

VAST 9.2 indeed makes SMTP and IMAP so easy and has a wonderful API compared to the "swamp" we had in SST before that. Instantiations is making such great progress on so many edges of VAST. I am about to help a customer migrate from VAST 6.02 and am eager to see both their eyes when they touch 9.2.2. for the first time and the flash from the past when I touch 6.02 again ;-)


I did something that comes close to a port of MIMEMailApp from Pharo 6 or seven a bit more than a year ago. It is far from providing a nice API for assembling and parsing mail messages, but it is a start. I also fixed a few things that didn't work in te original implementation and removed some Pharo specific classes/prerequisites. At the sime time I introduced some dependencies from Seaside/Grease, e.g. for MIME types, so this is not something that will work out of the box. It does send a few dozen mixed html/plain text mails with attachments every day in our Kontolino servers, so I guess it is a good starting point.

It's not code I am proud of, nor is the API very good so I don't think this is what assembling mail messages in VAST should look like in the future. But it is a starting point. I didn't dare pushing it to VASTGooedies, so I am attaching it here.


I hope it helps. Please let me know if you find errors. Maybe this could be one of the early additions to the new Community hub on Github ?

Joachim


P.S.: I'd be interested to learn about your carbon copy / blind carbon copy stuff. Are you extracting these infos from the mail's headers and copy automagically?

P.S.: I am looking for reliable ways of finding out whether a mail reached its recipient, or better: to find out which original message an "undelivered" mail belongs to. We need to know who didn't receive their invoices, for example. So if you have links, book or article suggestions, please feel free to share...


Am Donnerstag, 11. Juni 2020 19:28:57 UTC+2 schrieb Julian Ford:
Hello....

I am starting to switch over from using EMan to using the VAST SMTP EMail framework,
and it appears to be very powerful and easy to use.  I have already proven it works
in situations that EMan was never able to handle.

I have already added my own framework around it, to permit sending HTML, and using
blind carbon copy.

I would like to add the ability to include attachments as well.

I know this is generally just a matter of adding the appropriate headers,
and I do not expect to have any problems doing that.
But before I reinvent the wheel, I thought I'd ask if anyone else has already
done that.

I am specifically looking to use SMTP.

Any assistance is greatly appreciated....

Best Regards,
Julian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/a477cfff-5f13-439d-93c3-05ea0fe5fa40o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

rjuli...@gmail.com
In reply to this post by Seth Berman
Hey, Seth!

I am happy to share what I have done...as long as everyone understands that I am
NO SMTP guru by any stretch...and that I was looking for a quick and very targetted
approach (that is the disclaimer so that no one looks at my code and rolls their eyes!).

Having you help would be great....you could end up offering it to others, like your
famous Tetris application!  (LOL....sorry to everyone else.....inside joke).

Stay safe and healthy....

Julian

On Friday, June 12, 2020 at 3:41:10 PM UTC-4, Seth Berman wrote:
Hi All,

This is really cool work.  I would be willing to jump in and help on this, as well!

- Seth

On Friday, June 12, 2020 at 3:33:50 PM UTC-4 Mariano Martinez Peck wrote:
Hi guys,

It's great to see everybody helping each other. Now:

* Adriaan said they use TobSockets to compose multipart. 
* Joachim said he uses a port of MIMEMailApp
* Julian just finished his own solution

I noticed Joachim quote "Maybe this could be one of the early additions to the new Community hub on Github ?" and I couldn't agree more :)
I think it would be a nice addition and we can also document the project (add some example, some documentation, etc.). If you give me an ENVY dat file and some instructions to test it, then I can help with the Tonel export and I can submit a first draft into Github. 

Best, 


On Fri, Jun 12, 2020 at 3:07 PM Julian Ford <[hidden email]> wrote:
Hello, Joachim.

Nice to hear from you...
I think of those days drinking Mirto in Sardenia quite a bit, lately!!!

I greatly appreciate you taking the time to respond, and send me your code.
As it happens, I actually completed my own solution last night.
I can now create an EMail, set it as HTML or not, attach any number of files,
choose whether the EMail should be base64 encoded or not,
and select both CC and BCC options.

So....thank you!!  I'm afraid I just ended up finishing quicker than I expected.
You are right...this new framework is really nice.

As for the CC and BCC stuff....
First of all it is critical to keep any BCC information out of the headers.
I learned that the hard way, some years ago, when I discovered that GMAIL
can show all of the headers...and thereby display the BCC list.

So, my solution, is that I have a bcc and cc instance variables in my EMailMessage
class (names simplified for illustration).
When I format the headers, to send at the DATA step, I do the following:

( self carbonCopy notNilOrEmpty ) ifTrue: [
aStream nextPutAll: 'cc: '.
self carbonCopy doWithIndex: [ :address :index |
( index > 1 ) ifTrue: [ aStream nextPutAll: '; ' ].
aStream nextPutAll: address.
].
aStream cr.
].

I do not add anything to do with the bcc list into this DATA step.

Then, when I actually send the message, I use the following:

sstSmtpClient sendMail: (anEMailMessage formattedMessage) from: self senderName to: anEMailMessage allRecipients

where #allRecipients is

| list |
list := OrderedCollection new.

( self recipientAddress notNilOrBlankString ) ifTrue: [ list add: self recipientAddress ].

( self carbonCopy notNilOrEmpty ) ifTrue: [ list addAll: self carbonCopy ].
( self blindCopy notNilOrEmpty ) ifTrue: [ list addAll: self blindCopy ].

^list

I hope you find that useful!

Thanks again!!!!

Julian






On Friday, June 12, 2020 at 12:12:46 AM UTC-4, Joachim Tuchel wrote:
Julian,

VAST 9.2 indeed makes SMTP and IMAP so easy and has a wonderful API compared to the "swamp" we had in SST before that. Instantiations is making such great progress on so many edges of VAST. I am about to help a customer migrate from VAST 6.02 and am eager to see both their eyes when they touch 9.2.2. for the first time and the flash from the past when I touch 6.02 again ;-)


I did something that comes close to a port of MIMEMailApp from Pharo 6 or seven a bit more than a year ago. It is far from providing a nice API for assembling and parsing mail messages, but it is a start. I also fixed a few things that didn't work in te original implementation and removed some Pharo specific classes/prerequisites. At the sime time I introduced some dependencies from Seaside/Grease, e.g. for MIME types, so this is not something that will work out of the box. It does send a few dozen mixed html/plain text mails with attachments every day in our Kontolino servers, so I guess it is a good starting point.

It's not code I am proud of, nor is the API very good so I don't think this is what assembling mail messages in VAST should look like in the future. But it is a starting point. I didn't dare pushing it to VASTGooedies, so I am attaching it here.


I hope it helps. Please let me know if you find errors. Maybe this could be one of the early additions to the new Community hub on Github ?

Joachim


P.S.: I'd be interested to learn about your carbon copy / blind carbon copy stuff. Are you extracting these infos from the mail's headers and copy automagically?

P.S.: I am looking for reliable ways of finding out whether a mail reached its recipient, or better: to find out which original message an "undelivered" mail belongs to. We need to know who didn't receive their invoices, for example. So if you have links, book or article suggestions, please feel free to share...


Am Donnerstag, 11. Juni 2020 19:28:57 UTC+2 schrieb Julian Ford:
Hello....

I am starting to switch over from using EMan to using the VAST SMTP EMail framework,
and it appears to be very powerful and easy to use.  I have already proven it works
in situations that EMan was never able to handle.

I have already added my own framework around it, to permit sending HTML, and using
blind carbon copy.

I would like to add the ability to include attachments as well.

I know this is generally just a matter of adding the appropriate headers,
and I do not expect to have any problems doing that.
But before I reinvent the wheel, I thought I'd ask if anyone else has already
done that.

I am specifically looking to use SMTP.

Any assistance is greatly appreciated....

Best Regards,
Julian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to va-smalltalk...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com.


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.
Twitter: <a href="https://twitter.com/MartinezPeck" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftwitter.com%2FMartinezPeck\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFPV-7Bnc-U6phGEh-VZU0iUtY7vw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftwitter.com%2FMartinezPeck\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFPV-7Bnc-U6phGEh-VZU0iUtY7vw&#39;;return true;">https://twitter.com/MartinezPeck
LinkedIn: <a href="https://www.linkedin.com/in/mariano-mart%C3%ADnez-peck/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.linkedin.com%2Fin%2Fmariano-mart%25C3%25ADnez-peck%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGyJTUAWXPstaw4J3OpFUYRyFAqmw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.linkedin.com%2Fin%2Fmariano-mart%25C3%25ADnez-peck%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGyJTUAWXPstaw4J3OpFUYRyFAqmw&#39;;return true;">www.linkedin.com/in/mariano-martinez-peck
Blog: <a href="https://marianopeck.wordpress.com/" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmarianopeck.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHAOaIsyMIYgmQWdQZRuKRdD6gBfw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmarianopeck.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHAOaIsyMIYgmQWdQZRuKRdD6gBfw&#39;;return true;">https://marianopeck.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/5954022b-ba7d-4ef4-9e0a-cbc0ed80e8cbo%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

rjuli...@gmail.com
In reply to this post by Mariano Martinez Peck-2
Great idea, Mariano!

On Friday, June 12, 2020 at 3:33:50 PM UTC-4, Mariano Martinez Peck wrote:
Hi guys,

It's great to see everybody helping each other. Now:

* Adriaan said they use TobSockets to compose multipart. 
* Joachim said he uses a port of MIMEMailApp
* Julian just finished his own solution

I noticed Joachim quote "Maybe this could be one of the early additions to the new Community hub on Github ?" and I couldn't agree more :)
I think it would be a nice addition and we can also document the project (add some example, some documentation, etc.). If you give me an ENVY dat file and some instructions to test it, then I can help with the Tonel export and I can submit a first draft into Github. 

Best, 


On Fri, Jun 12, 2020 at 3:07 PM Julian Ford <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="syJcCoOyAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rjuli...@...> wrote:
Hello, Joachim.

Nice to hear from you...
I think of those days drinking Mirto in Sardenia quite a bit, lately!!!

I greatly appreciate you taking the time to respond, and send me your code.
As it happens, I actually completed my own solution last night.
I can now create an EMail, set it as HTML or not, attach any number of files,
choose whether the EMail should be base64 encoded or not,
and select both CC and BCC options.

So....thank you!!  I'm afraid I just ended up finishing quicker than I expected.
You are right...this new framework is really nice.

As for the CC and BCC stuff....
First of all it is critical to keep any BCC information out of the headers.
I learned that the hard way, some years ago, when I discovered that GMAIL
can show all of the headers...and thereby display the BCC list.

So, my solution, is that I have a bcc and cc instance variables in my EMailMessage
class (names simplified for illustration).
When I format the headers, to send at the DATA step, I do the following:

( self carbonCopy notNilOrEmpty ) ifTrue: [
aStream nextPutAll: 'cc: '.
self carbonCopy doWithIndex: [ :address :index |
( index > 1 ) ifTrue: [ aStream nextPutAll: '; ' ].
aStream nextPutAll: address.
].
aStream cr.
].

I do not add anything to do with the bcc list into this DATA step.

Then, when I actually send the message, I use the following:

sstSmtpClient sendMail: (anEMailMessage formattedMessage) from: self senderName to: anEMailMessage allRecipients

where #allRecipients is

| list |
list := OrderedCollection new.

( self recipientAddress notNilOrBlankString ) ifTrue: [ list add: self recipientAddress ].

( self carbonCopy notNilOrEmpty ) ifTrue: [ list addAll: self carbonCopy ].
( self blindCopy notNilOrEmpty ) ifTrue: [ list addAll: self blindCopy ].

^list

I hope you find that useful!

Thanks again!!!!

Julian






On Friday, June 12, 2020 at 12:12:46 AM UTC-4, Joachim Tuchel wrote:
Julian,

VAST 9.2 indeed makes SMTP and IMAP so easy and has a wonderful API compared to the "swamp" we had in SST before that. Instantiations is making such great progress on so many edges of VAST. I am about to help a customer migrate from VAST 6.02 and am eager to see both their eyes when they touch 9.2.2. for the first time and the flash from the past when I touch 6.02 again ;-)


I did something that comes close to a port of MIMEMailApp from Pharo 6 or seven a bit more than a year ago. It is far from providing a nice API for assembling and parsing mail messages, but it is a start. I also fixed a few things that didn't work in te original implementation and removed some Pharo specific classes/prerequisites. At the sime time I introduced some dependencies from Seaside/Grease, e.g. for MIME types, so this is not something that will work out of the box. It does send a few dozen mixed html/plain text mails with attachments every day in our Kontolino servers, so I guess it is a good starting point.

It's not code I am proud of, nor is the API very good so I don't think this is what assembling mail messages in VAST should look like in the future. But it is a starting point. I didn't dare pushing it to VASTGooedies, so I am attaching it here.


I hope it helps. Please let me know if you find errors. Maybe this could be one of the early additions to the new Community hub on Github ?

Joachim


P.S.: I'd be interested to learn about your carbon copy / blind carbon copy stuff. Are you extracting these infos from the mail's headers and copy automagically?

P.S.: I am looking for reliable ways of finding out whether a mail reached its recipient, or better: to find out which original message an "undelivered" mail belongs to. We need to know who didn't receive their invoices, for example. So if you have links, book or article suggestions, please feel free to share...


Am Donnerstag, 11. Juni 2020 19:28:57 UTC+2 schrieb Julian Ford:
Hello....

I am starting to switch over from using EMan to using the VAST SMTP EMail framework,
and it appears to be very powerful and easy to use.  I have already proven it works
in situations that EMan was never able to handle.

I have already added my own framework around it, to permit sending HTML, and using
blind carbon copy.

I would like to add the ability to include attachments as well.

I know this is generally just a matter of adding the appropriate headers,
and I do not expect to have any problems doing that.
But before I reinvent the wheel, I thought I'd ask if anyone else has already
done that.

I am specifically looking to use SMTP.

Any assistance is greatly appreciated....

Best Regards,
Julian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="syJcCoOyAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">va-sma...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com.


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.
Email: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="syJcCoOyAQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mp...@instantiations.com
Twitter: <a href="https://twitter.com/MartinezPeck" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftwitter.com%2FMartinezPeck\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFPV-7Bnc-U6phGEh-VZU0iUtY7vw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Ftwitter.com%2FMartinezPeck\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFPV-7Bnc-U6phGEh-VZU0iUtY7vw&#39;;return true;">https://twitter.com/MartinezPeck
LinkedIn: <a href="https://www.linkedin.com/in/mariano-mart%C3%ADnez-peck/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.linkedin.com%2Fin%2Fmariano-mart%25C3%25ADnez-peck%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGyJTUAWXPstaw4J3OpFUYRyFAqmw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.linkedin.com%2Fin%2Fmariano-mart%25C3%25ADnez-peck%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGyJTUAWXPstaw4J3OpFUYRyFAqmw&#39;;return true;">www.linkedin.com/in/mariano-martinez-peck
Blog: <a href="https://marianopeck.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmarianopeck.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHAOaIsyMIYgmQWdQZRuKRdD6gBfw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fmarianopeck.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHAOaIsyMIYgmQWdQZRuKRdD6gBfw&#39;;return true;">https://marianopeck.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/7c7921b4-4fc6-4e92-8ad6-5d8ab55fec01o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

Richard Sargent
Administrator
In reply to this post by rjuli...@gmail.com


On Friday, June 12, 2020 at 3:00:02 PM UTC-7, Julian Ford wrote:
Hello, Richard.

Thank you for the design suggestions.

You are right that I did tend to limit my vision on this to my current need.
For example, there can never be more than one recipient in my domain.

The reason I put in conditional logic, is that I was assuming a CC header must not appear
in the DATA segment, if there is no one being copied.

That's is why you might have #writeHeader:list: and #writeMandatoryHeader:list:implementations. The former would be conditional on the list not being empty and would call the latter. The latter being unconditional, for those cases where you could have or need the header even if there is no value. (Not that I know of one.)


I agree completely, though, that polymorphic behaviour is far better than using conditional logic.

Mostly, what I have right now, was just a proof of concept.  I have hundreds of users, who are suddenly
trying to use EMail from my application (even though I introduced it about 10 years ago!), because of
the current restrictions.
With that, I had run into a few users, whose authentication required OAUTH, and EMan (which worked
quite well for all of this time) did not support it.  I considered extending EMan, or just finally making
the break, and going with the new VAST SstSmtpClient stuff.

Understood. Expediency is sometimes the most crucial consideration.


I have everything working now, but will almost certainly spend some time smoothing out the rough edges.

Thanks for taking the time to respond....

Julian


On Friday, June 12, 2020 at 3:38:44 PM UTC-4, Richard Sargent wrote:
On Friday, June 12, 2020 at 11:07:14 AM UTC-7, Julian Ford wrote:
Hello, Joachim.

Nice to hear from you...
I think of those days drinking Mirto in Sardenia quite a bit, lately!!!

I greatly appreciate you taking the time to respond, and send me your code.
As it happens, I actually completed my own solution last night.
I can now create an EMail, set it as HTML or not, attach any number of files,
choose whether the EMail should be base64 encoded or not,
and select both CC and BCC options.

So....thank you!!  I'm afraid I just ended up finishing quicker than I expected.
You are right...this new framework is really nice.

As for the CC and BCC stuff....
First of all it is critical to keep any BCC information out of the headers.
I learned that the hard way, some years ago, when I discovered that GMAIL
can show all of the headers...and thereby display the BCC list.

So, my solution, is that I have a bcc and cc instance variables in my EMailMessage
class (names simplified for illustration).
When I format the headers, to send at the DATA step, I do the following:

( self carbonCopy notNilOrEmpty ) ifTrue: [
aStream nextPutAll: 'cc: '.
self carbonCopy doWithIndex: [ :address :index |
( index > 1 ) ifTrue: [ aStream nextPutAll: '; ' ].
aStream nextPutAll: address.
].
aStream cr.
].

I do not add anything to do with the bcc list into this DATA step.

Then, when I actually send the message, I use the following:

sstSmtpClient sendMail: (anEMailMessage formattedMessage) from: self senderName to: anEMailMessage allRecipients

where #allRecipients is

| list |
list := OrderedCollection new.

( self recipientAddress notNilOrBlankString ) ifTrue: [ list add: self recipientAddress ].

( self carbonCopy notNilOrEmpty ) ifTrue: [ list addAll: self carbonCopy ].
( self blindCopy notNilOrEmpty ) ifTrue: [ list addAll: self blindCopy ].

^list

I hope you find that useful!

Hi Julian,

I want to pass on some design thoughts, inspired by a lesson I learned waaay back in '89. Your use case may be sufficiently different that they don't apply, but in general, they will if you go to use the emailing code for another purpose later.

1) Get rid of all the conditional logic.
2) Model the email message protocol not the subset you use today.
3) Test for empty collections only when it matters. (it often doesn't / rarely does)

Specifically, model the existence of 0 or more (primary) recipients, 0 or more carbon copy recipients, and 0 or more blind copy recipients. Don't model a single primary recipient when an email can be addressed to multiple people. The step function from 1 to many is huge, so start with having it right.

And initialize all three collections to an empty collection. Then just use #primaryRecipients, #carbonCopyRecipients, and #blindRecipients knowing they will do exactly what you need. You will find use for a method like #writeHeader:list: convenient for both the To header and the CC header. And probably some others.


Thanks again!!!!

Julian






On Friday, June 12, 2020 at 12:12:46 AM UTC-4, Joachim Tuchel wrote:
Julian,

VAST 9.2 indeed makes SMTP and IMAP so easy and has a wonderful API compared to the "swamp" we had in SST before that. Instantiations is making such great progress on so many edges of VAST. I am about to help a customer migrate from VAST 6.02 and am eager to see both their eyes when they touch 9.2.2. for the first time and the flash from the past when I touch 6.02 again ;-)


I did something that comes close to a port of MIMEMailApp from Pharo 6 or seven a bit more than a year ago. It is far from providing a nice API for assembling and parsing mail messages, but it is a start. I also fixed a few things that didn't work in te original implementation and removed some Pharo specific classes/prerequisites. At the sime time I introduced some dependencies from Seaside/Grease, e.g. for MIME types, so this is not something that will work out of the box. It does send a few dozen mixed html/plain text mails with attachments every day in our Kontolino servers, so I guess it is a good starting point.

It's not code I am proud of, nor is the API very good so I don't think this is what assembling mail messages in VAST should look like in the future. But it is a starting point. I didn't dare pushing it to VASTGooedies, so I am attaching it here.


I hope it helps. Please let me know if you find errors. Maybe this could be one of the early additions to the new Community hub on Github ?

Joachim


P.S.: I'd be interested to learn about your carbon copy / blind carbon copy stuff. Are you extracting these infos from the mail's headers and copy automagically?

P.S.: I am looking for reliable ways of finding out whether a mail reached its recipient, or better: to find out which original message an "undelivered" mail belongs to. We need to know who didn't receive their invoices, for example. So if you have links, book or article suggestions, please feel free to share...


Am Donnerstag, 11. Juni 2020 19:28:57 UTC+2 schrieb Julian Ford:
Hello....

I am starting to switch over from using EMan to using the VAST SMTP EMail framework,
and it appears to be very powerful and easy to use.  I have already proven it works
in situations that EMan was never able to handle.

I have already added my own framework around it, to permit sending HTML, and using
blind carbon copy.

I would like to add the ability to include attachments as well.

I know this is generally just a matter of adding the appropriate headers,
and I do not expect to have any problems doing that.
But before I reinvent the wheel, I thought I'd ask if anyone else has already
done that.

I am specifically looking to use SMTP.

Any assistance is greatly appreciated....

Best Regards,
Julian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/d70c8cfb-584b-4839-877f-8e6d64c6b7eao%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

Seth Berman
In reply to this post by rjuli...@gmail.com
"I am happy to share what I have done...quick and very targeted approach"
- Fine by me, I'm good with having a starting point and working with it a bit.
Plus, I'd prefer to see how application devs like yourself prefer to use it.

"like your famous Tetris application"
- That's how I'll always think of it;)

- Seth
On Friday, June 12, 2020 at 6:04:09 PM UTC-4 [hidden email] wrote:
Hey, Seth!

I am happy to share what I have done...as long as everyone understands that I am
NO SMTP guru by any stretch...and that I was looking for a quick and very targetted
approach (that is the disclaimer so that no one looks at my code and rolls their eyes!).

Having you help would be great....you could end up offering it to others, like your
famous Tetris application!  (LOL....sorry to everyone else.....inside joke).

Stay safe and healthy....

Julian


On Friday, June 12, 2020 at 3:41:10 PM UTC-4, Seth Berman wrote:
Hi All,

This is really cool work.  I would be willing to jump in and help on this, as well!

- Seth

On Friday, June 12, 2020 at 3:33:50 PM UTC-4 Mariano Martinez Peck wrote:
Hi guys,

It's great to see everybody helping each other. Now:

* Adriaan said they use TobSockets to compose multipart. 
* Joachim said he uses a port of MIMEMailApp
* Julian just finished his own solution

I noticed Joachim quote "Maybe this could be one of the early additions to the new Community hub on Github ?" and I couldn't agree more :)
I think it would be a nice addition and we can also document the project (add some example, some documentation, etc.). If you give me an ENVY dat file and some instructions to test it, then I can help with the Tonel export and I can submit a first draft into Github. 

Best, 


On Fri, Jun 12, 2020 at 3:07 PM Julian Ford <[hidden email]> wrote:
Hello, Joachim.

Nice to hear from you...
I think of those days drinking Mirto in Sardenia quite a bit, lately!!!

I greatly appreciate you taking the time to respond, and send me your code.
As it happens, I actually completed my own solution last night.
I can now create an EMail, set it as HTML or not, attach any number of files,
choose whether the EMail should be base64 encoded or not,
and select both CC and BCC options.

So....thank you!!  I'm afraid I just ended up finishing quicker than I expected.
You are right...this new framework is really nice.

As for the CC and BCC stuff....
First of all it is critical to keep any BCC information out of the headers.
I learned that the hard way, some years ago, when I discovered that GMAIL
can show all of the headers...and thereby display the BCC list.

So, my solution, is that I have a bcc and cc instance variables in my EMailMessage
class (names simplified for illustration).
When I format the headers, to send at the DATA step, I do the following:

( self carbonCopy notNilOrEmpty ) ifTrue: [
aStream nextPutAll: 'cc: '.
self carbonCopy doWithIndex: [ :address :index |
( index > 1 ) ifTrue: [ aStream nextPutAll: '; ' ].
aStream nextPutAll: address.
].
aStream cr.
].

I do not add anything to do with the bcc list into this DATA step.

Then, when I actually send the message, I use the following:

sstSmtpClient sendMail: (anEMailMessage formattedMessage) from: self senderName to: anEMailMessage allRecipients

where #allRecipients is

| list |
list := OrderedCollection new.

( self recipientAddress notNilOrBlankString ) ifTrue: [ list add: self recipientAddress ].

( self carbonCopy notNilOrEmpty ) ifTrue: [ list addAll: self carbonCopy ].
( self blindCopy notNilOrEmpty ) ifTrue: [ list addAll: self blindCopy ].

^list

I hope you find that useful!

Thanks again!!!!

Julian






On Friday, June 12, 2020 at 12:12:46 AM UTC-4, Joachim Tuchel wrote:
Julian,

VAST 9.2 indeed makes SMTP and IMAP so easy and has a wonderful API compared to the "swamp" we had in SST before that. Instantiations is making such great progress on so many edges of VAST. I am about to help a customer migrate from VAST 6.02 and am eager to see both their eyes when they touch 9.2.2. for the first time and the flash from the past when I touch 6.02 again ;-)


I did something that comes close to a port of MIMEMailApp from Pharo 6 or seven a bit more than a year ago. It is far from providing a nice API for assembling and parsing mail messages, but it is a start. I also fixed a few things that didn't work in te original implementation and removed some Pharo specific classes/prerequisites. At the sime time I introduced some dependencies from Seaside/Grease, e.g. for MIME types, so this is not something that will work out of the box. It does send a few dozen mixed html/plain text mails with attachments every day in our Kontolino servers, so I guess it is a good starting point.

It's not code I am proud of, nor is the API very good so I don't think this is what assembling mail messages in VAST should look like in the future. But it is a starting point. I didn't dare pushing it to VASTGooedies, so I am attaching it here.


I hope it helps. Please let me know if you find errors. Maybe this could be one of the early additions to the new Community hub on Github ?

Joachim


P.S.: I'd be interested to learn about your carbon copy / blind carbon copy stuff. Are you extracting these infos from the mail's headers and copy automagically?

P.S.: I am looking for reliable ways of finding out whether a mail reached its recipient, or better: to find out which original message an "undelivered" mail belongs to. We need to know who didn't receive their invoices, for example. So if you have links, book or article suggestions, please feel free to share...


Am Donnerstag, 11. Juni 2020 19:28:57 UTC+2 schrieb Julian Ford:
Hello....

I am starting to switch over from using EMan to using the VAST SMTP EMail framework,
and it appears to be very powerful and easy to use.  I have already proven it works
in situations that EMan was never able to handle.

I have already added my own framework around it, to permit sending HTML, and using
blind carbon copy.

I would like to add the ability to include attachments as well.

I know this is generally just a matter of adding the appropriate headers,
and I do not expect to have any problems doing that.
But before I reinvent the wheel, I thought I'd ask if anyone else has already
done that.

I am specifically looking to use SMTP.

Any assistance is greatly appreciated....

Best Regards,
Julian

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/09e9dd52-0426-4585-a61f-50765d64b6a7o%40googlegroups.com.


--
Mariano Martinez Peck
Software Engineer, Instantiations Inc.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/1566ea23-29f4-4e22-a0ae-072c00b05610n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

Wayne Johnston
In reply to this post by rjuli...@gmail.com
I am getting an error trying to import the MIMEMailApp.app -
Can not open the library MIMEMailApp.app because the library header is not valid.

Just wanting to load it to see how to add attachments... 

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/8a52560b-cc97-4702-a93e-b047f8990de9o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

Richard Sargent
Administrator
On Mon, Oct 12, 2020 at 5:42 PM Wayne Johnston <[hidden email]> wrote:
I am getting an error trying to import the MIMEMailApp.app -
Can not open the library MIMEMailApp.app because the library header is not valid.

I think a .app file is just a file out of the application. See if it is plain text.
Typically, you import from a .dat file.


Just wanting to load it to see how to add attachments... 

--
You received this message because you are subscribed to a topic in the Google Groups "VA Smalltalk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/va-smalltalk/vawgT-_NaM8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/8a52560b-cc97-4702-a93e-b047f8990de9o%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/CAGNapEOzNQsXRf6-BttHqS8LjPTDFvgnLkjqkYp5phwdf-PgTA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

Wayne Johnston
Oops.  Thanks!

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/6e86a488-8dfb-4094-8f5d-dbd093c9f65eo%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

Wayne Johnston
I have QuotedPrintableCoderApp and SeasideCoreApp loaded, so could file that code in.  And I have GreaseCoreApp and GreaseVASTCoreApp loaded too.  But there are several methods with the yellow exclamation mark meaning referencing a method that doesn't exist.  Perhaps a complete list of non-existent methods:  asFileReference, binaryWriteStreamDo:, beginsWith:, decodeMimeHeader, asText, primUTCSecondsClock, asTwoCharacterString, Date class>>#fromSeconds:.  Where do I get them?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/9df77afd-330f-4161-936d-e265d721c8bao%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Using VAST SMTP EMail framework

jtuchel
Wayne,

sorry for that. Maybe my "port" is a bit brute force. MIMEDocument>>#saveToFile: isn't used when sending mails, so I didn't actually care. Same for the others you mentioned.
If you need that code, you'd have to go get it from Pharo.

When I ported this stuff, it was the least ugly thing to port and get my stuff working. I still find this whole MIMEMessage cruft an excellent example of a completely failed API ;-) But sometimes you need to use brute force to get something done.

I would rather see a nice and clean wrapper for building emails in a comprehensive way. There are nice examples in, say, Python. But I could either build me a nice little library for constructing mails and let my other work mature until it gets done by itself or follow some short path...


Joachim



[hidden email] schrieb am Dienstag, 13. Oktober 2020 um 17:30:34 UTC+2:
I have QuotedPrintableCoderApp and SeasideCoreApp loaded, so could file that code in.  And I have GreaseCoreApp and GreaseVASTCoreApp loaded too.  But there are several methods with the yellow exclamation mark meaning referencing a method that doesn't exist.  Perhaps a complete list of non-existent methods:  asFileReference, binaryWriteStreamDo:, beginsWith:, decodeMimeHeader, asText, primUTCSecondsClock, asTwoCharacterString, Date class>>#fromSeconds:.  Where do I get them?

--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/va-smalltalk/82aa033c-6259-4a39-8160-7b4eb431ebedn%40googlegroups.com.