Wiser II email sending and email character limit

Discussion in 'C-Bus Wiser 2 Controller' started by pgardiner, Jul 21, 2015.

  1. pgardiner

    pgardiner

    Joined:
    Dec 21, 2004
    Messages:
    51
    Likes Received:
    1
    Gents, I have wiser II here for a client, we have barely got the unit sending emails using logic SendEMail(0, using a Gmail account. This is in itself not reliable, some emails send some don't.

    Any info on reliable email sending would be helpful. Using Gmail account in pop setup, ports 110, 587, TLS pop.gmail.com, smtp.gmail.com

    However the real issue is the max length of characters, SendEMail(0, will format in the email string. SendEMail(0, EMailAddress, Subject, Body); will only send a maximum of 30 characters, this according to Schneider Australia is the max limit. A useless amount of text!

    There is a workaround in the CTC using and array to set the max length, EMailString : array[0..4095] of char;
    This works on the CTC but I’m being told the wiser II doesn’t have the processing power of the CTC and will not work using EMailString : array[0..4095] of char;

    Cant use CTC for email as it doesn't support secured SMTP or POP TLS/SSL

    Also I wanted build a multiline array of email content and send a single email containing information rather than several single emails.
    I wanted to use the “char” character type function to add carriage returns and line feeds i.e.

    Format(EMailString,
    'The Study Lights have been switched on', #13, #10,
    'The Burglar Alarm had been armed ', #13, #10,
    'The Burglar Alarm had been disarmed', #13, #10);
    'The Burglar Alarm had been triggered', #13, #10);

    Using latest PICED version of fully updated Wiser II

    Does anyone have any ideas or experience with the above, many thanks.
     
    Last edited by a moderator: Aug 8, 2015
    pgardiner, Jul 21, 2015
    #1
  2. pgardiner

    MHeaton

    Joined:
    Apr 22, 2008
    Messages:
    106
    Likes Received:
    2
    Location:
    London
    Having now built a webserver (emitting JSON) and several other socket based interfaces why not just implement the SMTP protocol yourself. it is pretty straightforward unless you implement TLS etc.

    I don't think you will be able to write a 4k string on its own but you could send several contiguous chunks of say 256 bytes. On my implementation I use a shared 640 byte buffer across all telnet sessions (as it reads into it sequentially) and then smaller device specific ones to hold inbound fragments.

    Mark
     
    MHeaton, Jul 22, 2015
    #2
  3. pgardiner

    pgardiner

    Joined:
    Dec 21, 2004
    Messages:
    51
    Likes Received:
    1
    Many thanks for the first reply, a bit beyond my capabilities unless you or others have a working code model.
    The TLS is based upon what wiser II will support, if there is a model for Gmail for example that will allow it to send email using the standard Gmail security formats then all the better. Not adverse to other email suppliers, outlook, gmx etc.
    In principle if there is a wiser II embedded work around then great.

    My fingers are always crossed!
     
    pgardiner, Jul 23, 2015
    #3
  4. pgardiner

    rhamer

    Joined:
    Aug 3, 2004
    Messages:
    673
    Likes Received:
    3
    Location:
    Melbourne, Australia
    To send email via Gmail it has to be sent using SSL/TLS.
    Constructing the SMTP protocol by hand and sending it unauthenticated in plain text will not work with Gmail, and most other SMTP servers these days.

    If the server is on your own domain it can often be set to allow unauthenticated SMTP, but if it's out on the internet there is almost no chance.

    Having said that, last time I checked BigPond would allow unauthrnticated SMTP if it originates from one of its own IP addresses, but I wouldn't guarantee it will stay that way.

    Cheers

    Rohan
     
    rhamer, Jul 23, 2015
    #4
  5. pgardiner

    pgardiner

    Joined:
    Dec 21, 2004
    Messages:
    51
    Likes Received:
    1
    Thanks for reply, sending emails is not an issue this works with some issues. Wiser will stop sending emails until it is rebooted, I can re produce this reliably.

    I do not think it is the email account as I set up a Gmail and GMX account, both work independently and both will stop sending email.

    To prove this I set up Wiser to send an email to both accounts at the same time, both work until it stops sending email to both at the same time.

    SendEMail(0, TargetEMailAddress, 'Cbus', EMailString);
    SendEMail(1, TargetEMailAddress, 'Cbus', EMailString);

    This bug together with the character limit is really frustrating.
     
    pgardiner, Aug 3, 2015
    #5
  6. pgardiner

    jboer

    Joined:
    Apr 27, 2012
    Messages:
    458
    Likes Received:
    35
    Location:
    Sydney
    I don't think it is a WISER II only thing. I have a couple of routines in my WISER I and it will happily send emails for a few weeks and then just stop until it is rebooted. I have been meaning to investigate it a bit more but haven't got around to it yet.

    I have found a similar thing happen with SP+ and it was where I was only using a SMTP server to send email and did not have a POP for it to try and get email from. It would try and get mail from the pop every 60 minutes and obviously couldn't, so after number of attempts (I am guessing about 100-200 as that is about the time period that it would always happen) it would stop all of the email functions until a restart. You can disable it from ever trying to connect to the POP server but you need to edit the project file directly, the PICED dialog won't let you.

    So one thing to try would be to ensure it can receive email as well as send?
     
    jboer, Aug 3, 2015
    #6
  7. pgardiner

    pgardiner

    Joined:
    Dec 21, 2004
    Messages:
    51
    Likes Received:
    1
    Thanks for reply, how did you or do you disable it from reading the POP account?

    My wiser will lock up after around 10 emails until rebooted.

    Best regards
     
    pgardiner, Aug 4, 2015
    #7
  8. pgardiner

    jboer

    Joined:
    Apr 27, 2012
    Messages:
    458
    Likes Received:
    35
    Location:
    Sydney
    Only 10 emails isn't many, what is the time period or doesn't it matter?

    Open your Wiser project file in XML and search for POP. Delete the server address and save the file.

    That should prevent it from trying to connect to a POP server.
     
    jboer, Aug 5, 2015
    #8
  9. pgardiner

    pgardiner

    Joined:
    Dec 21, 2004
    Messages:
    51
    Likes Received:
    1
    Thanks for reply,

    Wiser will lock up after about 5 - 20 emails, time doesn't seem to matter. Reboot recovers it.

    No I cant read the POP emails but this is not an issue, don't want to read them.

    Deleted POP server address as per image enclosed, blanked out other personal data.

    I guess this is correct?

    [​IMG]

    No improvement in locking up after deleting POP server.

    Which mail account and server are you using?

    Regards
     
    Last edited by a moderator: Aug 5, 2015
    pgardiner, Aug 5, 2015
    #9
  10. pgardiner

    jboer

    Joined:
    Apr 27, 2012
    Messages:
    458
    Likes Received:
    35
    Location:
    Sydney
    That is a bit sad.

    Yeah that is the right server address, just thought it was at least worth a try.

    I am using my 'own' (as in hosting companies) SMTP server with no encryption as the Wiser I and CTC ect do not support encryption.

    J
     
    jboer, Aug 6, 2015
    #10
  11. pgardiner

    pgardiner

    Joined:
    Dec 21, 2004
    Messages:
    51
    Likes Received:
    1
    Managed to get the email working with the CTC using https://www.hmailserver.com/ which acts like a mail server, it just handles the non encrypted CTC and then forwards it to my mail server. Seems to work reliably, sent 4000+ emails over night with no CTC lockups.
    Given up on Wiser as it still locks up after 10 -15 emails and with the 30 character limit is hopeless.

    CTC works with carriage return and long data strings and long formatted emails.

    Fingers crossed.
     
    pgardiner, Aug 12, 2015
    #11
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.