Send an email using a function block

masav1234
2011-09-06
2015-01-21
  • masav1234 - 2011-09-06

    Hi,

    Do you know if it is possible to send automatically an email using Codesys?
    I would like for example my system to warn me by mail when one of my pump is in fault.

    Thanks,

    masav

     
  • JAPIB

    JAPIB - 2011-09-07

    You can use Alarm Configuration (Ressources).
    Example : send an email when a boolean variable changes state, using SP PLCWinNT.

    1 - Define variable :
    VAR_GLOBAL
    B1:BOOL;(variable must send email)
    END_VAR

    2 - Create a new Alarm Classes called, for example, myalarm.
    3 - Choose action "Email"
    4 - Configure Email (by double clicking on Email action) :
    From : sender email or the PLC's name or what you want !
    To : You email address (The recipient's address)
    Subjetc : ....
    Message : TIME/EXPRESSION:MESSAGE Actual value = VALUE,
    Server : The address of the mail server

    5 - Select System and Append Subelement -> Alarm Group
    6 - Add a new alarm
    Expression : a variable you want it send email (B1 for example)
    Type : DIG=1
    Class : myalarm
    Message : B1 change state

    7- In the Target Setting, in visualization Tab, select "Alarmhandling in the PLC"
    8 - Build and Load application into the PLC, and run it !

    Now when B1=0 or B1=1 your PLC mustsend you an email, with the following text :
    h:mn:s/B1:B1 change state Actual value = 1.000000 (or 0.0000000)

    Best regards

     
  • slinky - 2012-05-25

    This is very helpful.

    I have a couple of questions though.
    Firstly, how can I define variables to be displayed in the message?
    i.e. what is the syntax for including variables in the message. I would like to send a collection of counter and timer values.

    Secondly. How do I handle sending an email if my account has a sending password?

    Thanks for your time.

     
  • ninanderson - 2015-01-20

    Hello,

    I've used this method in CoDeSys V2.3.9 but it seems to have disappeared in V3.5.

    Does anyone know how to send alarm mails in V3.5.4 SP2 please ?

     
  • shooter - 2015-01-21

    see oscat.de for a nice library containing this type of communication, separate lib.
    even in english.

     

Log in to post a comment.