In my last post I mentioned that I was working on a new way to extend the ERML command in ErlWeb so that they can be extended with a behavior in a different application. I’ve had the idea stuck in my head since then and I needed to get something operational so that I could focus on something else for a while.

Last week I rewrote the command processing so that is looks to the configuration file to see which ERML command modules are potentially available. After that it checks to see if the module is on the server, if it is a gen_erml behavior and finds out what functions meet the requirements to make then ERML commands; for now that means they have to start with erml and have 2 arguments.

I decided to start working with the existing commands and I got them up and running in short order. They are in the erml_core and erml_tags files. Eventually that will all be in the erml_core file and the erml_tag file will go away.

Today I decided that I needed to get the ERML commands working from a different module. I had already setup ERML command modules for all of the EIF projects and since I have the most work done on ErlMail it made the most sense to start there.

Sending email from a web page is a pretty common activity and with the interaction of the EIF applications this was always destine to be a feature to ERML. This is now a reality.

In the ErlMail application the ERML command file is erml_erlmail. There is a function called ermlsmtp that will now take information about the IP address to comment, who the message is from, who it is to, the subject of the message and then it will create a MIME message and send the message using the smtpc:sendmail command.

As of about 10 minutes ago I successfully sent a message from a web page that was processed through the ERML engine, it sent an email message to my test account on an SMTP server running ErlMail. After that I was able to see the message in the folder using an IMAP connection to the same ErlMail server. Since the IMAP server is not complete I was not able to see the body of the message, but that is more about the IMAP server then ERML at the moment.

Through this process I started to find some utilities that are going to be needed to write successful ERML commands. I have started to put them into the gen_erml module. I’m going to continue this process of refining the way ERML commands are created as I continue to implement new ERML command through the EIF.

Then the big news of this post is that the new ERML engine works and it is expandable without recompiling ErlWeb. It does still require more configuration then I am happy with, but that will get worked out over time.