Jump to content
C4 Forums | Control4

SMTP Driver that supports StartTLS for Microsoft Live.com SMTP Servers


David

Recommended Posts

Hi All,

 

I have uploaded my first attempt at a driver written with DriverWorks. The driver can be found in the Downloads area.

 

I am looking for help in testing with a wide range of SMTP servers out there and would like to get any feedback on positive /negative connection tests.

 

So far tested with stand open local SMTP servers, Microsoft Live.com on port 587 and Google Gmail.com on port 465 but also 587.

 

Brief details are :-

 

SMTP Client driver

 

Driver initially designed to work directly with Microsoft Live.com SMTP servers which use StartTLS negotiation on port 587 to upgrade a standard plain SMTP connection to TLS Version 1 and the start an SMTP conversation.

 

Driver extended to work with wide range of SMTP servers whether using StartTLS or direct SSL connections, normally on port 465.

 

Plain connections also supported.

 

Authentication support using AUTH LOGIN or PLAIN but also open relay for in-house SMTP servers.

 

Initial release just allows simple sending of basic email but would like to hear feedback on use with different SMTP servers.

 

My first driver so please be gentle.

 

Thank you

 

 

David

 
Link to comment
Share on other sites


  • Replies 58
  • Created
  • Last Reply

I just had this loaded in for me and its awesome!  

 

A Few Ideas/Additions:

1) Add the ability to send attachment(s), like camera images

2) The ability to send Variable(s), like temperature or status of a door

3) Instead of just "Send Mail", maybe have the programming description say like "Send Mail to <EMAIL> with subject <SUBJECT>" - that way when I look back after programming I can quickly see what the email was about and who it was going to

 

But still a very awesome driver!

Link to comment
Share on other sites

Thank you for you comments

 

The initial release is just for testing with as many SMTP servers as possible.

 

In terms of Email creation I am looking at using the standard Email Notification setup which has a nice interface for composing emails with variables etc. 

 

From a programming perspective it will be exactly the same as using the standard Email Notifications with the addition of one more command.

 

I will look at attachments also but am still a little new to this so please bear with me.

 

Thank you

 

David

Link to comment
Share on other sites

Apologies for not explaining. Screenshots enclosed.

 

You use the standard Email Notification agent to setup email templates and use them in programming as you would if you Control4 emailing.

 

To actually trigger the email to send using the SMTP Client you need to put it's SendMail command immediately above the Email Notification command.

 

The reason I have done it this way is that it allows for a nice easy editing window to compose emails etc.

 

Hope this helps.

 

Thank you

 

 

David

 

Email Setup.pdf

 

 

Link to comment
Share on other sites

Sorry, I still can't seem to get it work right.  Here is what the debug came up with:

 

//Putting the email template name "Control4 Test Email" in the Name field

ExecuteCommand(SendMail)
Command: Name - Value: Control4 Test Email
INFO: Sending Email For Event Control4 Test Email
INFO: Find Email Notification For Event Control4 Test Email
ERROR: No Email Notification Found For Event Control4 Test Email
 
//Leaving Name blank.
ExecuteCommand(SendMail)
Command: Name - Value:
ERROR: No Name Given For The Event
 
 
But I really do like the idea of being able to set up the emails with the native composer with the variables and everything!  Only really wish it had the ability for attachments, but I am very happy with this!
Link to comment
Share on other sites

Once then programming is done you may need to wait a few minutes for the DirectorState.xml file to flush to disk so it can be read back from the driver.

 

Doing a Composer Backup should flush this to disk straight away.

 

This is a bit of a pain until I can work out another way for getting the running configuration instantly from the driver itself.

 

Attachments will be added once I have a few other issues ironed out.

 

Thank you

 

 

David

Link to comment
Share on other sites

Yea, I tried it again, but I got:

 

ExecuteCommand(SendMail)
Command: Name - Value: Control4 Test Email
INFO: Sending Email For Event Control4 Test Email
INFO: Find Email Notification For Event Control4 Test Email
DEBUG: Found Email ?)
[string "Lua Code"]:114: attempt to index global 'email' (a nil value) (ExecuteCommand)
 
 
The template name is "Control4 Test Email".  I tried backing up the project and waiting a few days, but I still get this error.  Maybe you could give an option to use a template, or specify everything right from the SMTP driver (like was in ver 1.0.0)?
Link to comment
Share on other sites

Thank you controluser007.

 

Have fixed several issues.

 

Have also moved all the additional modules and functions code to a separate driver called Stonetree_Command.c4i. I have done this because I have started work on several drivers that all use the same code and this helps maintain a common base of functions.

 

The Stonetree_Command.c4i module needs to be loaded into the project first followed by the SMTP driver.

 

I have also added a QuickMail command that sends an email without the need to setup an Email Notification as you suggested.

 

When using Email Notifications you should not need to wait long before changes are recognised by the driver as the configuration gets flushed to disk every 5 minutes.

 

Both drivers are enclosed in a zip file.

 

Please remove the current SMTP driver and then install the Command driver followed by the SMTP driver.

 

Thank you 

 

David

 

 

Drivers.zip

Link to comment
Share on other sites

Should work fine if both drivers are loaded.

 

I did have problems initially with version numbering and found that Composer did not upload the driver once it have been previously installed.

 

I had to remove the drivers from the project in Composer and then remove them from the Director itself by SSHing to it and doing :-

 

rm /etc/c4i/Stonetree_Command.c4i /etc/c4i/Stonetree_SMTPClient.c4i

 

I then re-added the drivers to the project and all OK from there.

 

Thank you

 

David

Link to comment
Share on other sites

Ok, tried the new driver and it works with my gmail (and verizon SMTP server). I did find a bug, I think. It comes in when I have more than one email template I am trying to use. For instance, I have one email template called "Control4 Boot" and another called "Doorbell Ring". They are listed in that order under the email templates, and whenever I try to use the function to "Send the following email notification" with name=Doorbell Ring, it sends Control4 Boot instead. It does work when I specify Control4 Boot as well, but I can't seem to get it to send any other email template. I have both drivers loaded. The debug says looks like it picks up the Doorbell Ring name, but when I receive the email I still get the Control4 Boot instead. Here is the debug, any ideas?

ExecuteCommand(SendMail)

Command: Name - Value: Doorbell Ring

INFO: Find Email Notification For Event Doorbell Ring

000 SEND

Link to comment
Share on other sites

Control4user007, same email sending issue fixed. Please can you re-test.

 

I had to remove the driver from Composer and the Director and then re-install. Need to get my head around how driver updates work!

 

Thank you

 

David

 

attachicon.gifDriver Bundle.zip

 

To update driver you need to reboot your director.  you can go to system manager and stop the director server, wait 5 minutes, then restart it

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.