CUrly Mail Fun

Oh no…

Not ANOTHER E-Mail component.
Can’t someone create something fun for a change?
A Plugin to use excess client computing power to mine Bitcoin or something useful like that?

Well, sadly yes!
Yours truly is delivering to you yet another E-Mail component to add to your growing toolchest of more or less useless code.

And mine is bigger and much more powerful, also it’s by me, Alex, so it obviously immediately climbs to the top of your choices. Doesn’t it?

Oh get over it already, say what you want to say and be done with it!

4D IC command compatibility!
Yeah, you read that right!

Seriously?

Well, maybe I use a somewhat loose definition of full compatibility, but anyway, you will get my point.

Most commands are actually identical with the difference, that I added the catch string CUrl in front of the command names and the longint used to pass the SMTP reference is now a C_OBJECT.

Cut to the chase man!

Ok, here is what it would look like in 4D IC

$l_Error:=SMTP_New ($l_SMTP)
$l_Error:=SMTP_Host ($l_SMTP;"mail.foo.bar")
$l_Error:=SMTP_From ($l_SMTP;"test@foo.bar")
$l_Error:=SMTP_Auth ($l_SMTP;"moo@foo.bar";"SuperSecret")
$l_Error:=SMTP_To ($l_SMTP;"choo@foo.bar")
$l_Error:=SMTP_Subject ($l_SMTP;"CUrlSmtp Testmail")
$l_Error:=SMTP_Body ($l_SMTP;"<html><body><h2>Hello there</h2><p>This is a test mail from CUrlSmtp for 4D</p><img width=200 height=200 id=\"abcd\" src=\"cid:abcd\"><p>we even embedded an image</p></body></html>";4)
$l_Error:=SMTP_Attachment ($l_SMTP;"TestInline.png";2;0;"abcd")
$l_Error:=Smtp_Attachment ($o_Mail;"TestAttachment.jpg")
$l_Error:=SMTP_Send ($l_SMTP)
$l_Error:=SMTP_Clear ($l_SMTP)

in a nutshell, yes, and so what?
And here is using my strong and stable genius solution:

$l_Error:=CUrlSmtp_New (->$o_Mail)
$l_Error:=CUrlSmtp_Host ($o_Mail;"mail.foo.bar")
$l_Error:=CUrlSmtp_From ($o_Mail;"test@foo.bar")
$l_Error:=CUrlSmtp_Auth ($o_Mail;"moo@foo.bar";"SuperSecret")
$l_Error:=CUrlSmtp_To ($o_Mail;"choo@foo.bar")
$l_Error:=CUrlSmtp_Subject ($o_Mail;"CUrlSmtp Testmail")
$l_Error:=CUrlSmtp_Body ($o_Mail;"<html><body><h2>Hello there</h2><p>This is a test mail from CUrlSmtp for 4D</p><img width=200 height=200 id=\"abcd\" src=\"cid:abcd\"><p>we even embedded an image</p></body></html>";4)
$l_Error:=CUrlSmtp_Attachment ($o_Mail;"TestInline.png";0;0;"abcd")
$l_Error:=CUrlSmtp_Attachment ($o_Mail;"TestAttachment.jpg")
$l_Error:=CUrlSmtp_Send ($o_Mail)
$l_Error:=CUrlSmtp_Clear ($o_Mail)

I fail to be impressed! You wasted my time for that?
The wheel reinvented?

Ah, my dear friend, you are missing the point!

  • Full communication debugging
  • Correct creation of multipart MIME messages with inline pictures for HTML and attachments
  • Handling of most ALL authentication systems
  • Bodies (html and plain) encoded quoted printable, much less trouble with spam filters than B64
  • Full SSL support
  • Runs on regular gas, no catalytic converter
  • Retains all nutrients in the message

Anyway, the point is, it solves quite a few problems we tend to have with 4D IC SMTP communication, it is fast and robust and obviously works on 32 and 64 Bit with 4D from 15.5 up to the current version.

Maybe it solves a problem you have, it did for me, and trying it is quick and painless.

In order for it to work, you will need 2 plugins from Keisuke:

cURL
and
MIME

You made it so far?

A few assumptions

For attachments I have trashed all the options like BinHex, Resource Fork, DataFork, yadda, yadda, yadda.
Attachments are always and exclusively sent as Base64.

Due to a problem in the PlugIn interface in earlier 4D Versions, this only works with Version 15.5 and onwards, 15R Versions need to be checked.

The source

As always you can have the password to the source for a teeny, tiny, huge donation, Paypal donate button is still on the sidebar.

Documentation

Although most commands are really fully compatible with the corresponding 4D IC commands, some behave a bit different, so I have created a page with the documentation, you can see it here:

CUrlSMTP – Documentation

Download

Ready for a spin?
Here you go:

Download AC_CUrlMail V15

Download AC_CUrlMail V16 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.