Email

  • Creator
    Topic
  • #48461
    Todd Yingling
    Participant

    Is there a way to send an email from cloverleaf? Currently, I have a procedure that based on certain criteria calls a unix script where the script emails a file to a group of people.  I was wondering if I could cut out the unix script and have cloverleaf send the email.

    Thanks,

Viewing 2 reply threads
  • Author
    Replies
    • #58696
      David Dillard
      Participant

      Hi,

      We send mail out from both alerts and tcl procs using the unix mail command.

      From an alert, use the exec action.  Echo out a mail message and then pipe it to the mail command:

      Code:

      exec {echo “this would be the body of the message” | mail -s “%A”  address1@mail.com,address2@mail.com }

      The %A variable contains information about the alert that triggered.


      From a tcl proc you can do the same thing:

      I usually setup arguments that will let us pass the email arguments into the procedure so we can change them without making changes to the code:

      Code:

      set email1 “default@mail.com”
      keylget args ARGS.EMAIL1 email1
      exec echo “body message” | mail -s “Subject” $email1

      More than one email address?

      Code:

      exec echo “body message” | mail -s “Subject” “$email1 $email2 $emaill3”

    • #58697
      Barry Sheesley
      Participant

      Todd,

      We have used the Tcl mime and SMTP packages to send email.  Here is a link that I found helpful to review:

      http://www.oche.de/~akupries/soft/mail/mime.html

      The Tcl proc we use is the following:

      proc sendEmailMessage {fromaddr recipient email_server subject body} {

      package require smtp

      package require mime

      set token [mime::initialize -canonical text/plain -string $body]

      mime::setheader $token Subject $subject

      smtp::sendmessage $token -recipients $recipient -servers

        -debug 1 -originator $fromaddr

        mime::finalize $token

          return

        }

        The variable “email_server” needs to be a valid email server.  You could modify this to pass a list of servers if needed. We pass the actual IP address of the server although I’m sure you could pass the server name as well.

        The “recipient” variable can actually contain multiple email addresses… I’m assuming a comma separated list but I haven’t tried that yet.

    • #58698
      John Mercogliano
      Participant

      Barry,

        Have you actually used this code from with in the engine or do you use it in a cron job.  I’m having problems using the socket command at all in a tps. See my post:

      http://clovertech.infor.com/viewtopic.php?t=1117” class=”bbcode_url”>http://clovertech.infor.com/viewtopic.php?t=1117

      Thanks,

      John Mercogliano
      Sentara Healthcare
      Hampton Roads, VA

Viewing 2 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,432
Topic Tags
286
Empty Topic Tags
10