Automic Workload Automation

Expand all | Collapse all

Attachment with mail

  • 1.  Attachment with mail

    Posted Oct 04, 2017 03:51 PM
    Hi,

    I am trying to attach Essbase load log file as an attachment to email.

    I used Unix job which is connected to Essbase server and added SENDMAIL function in process tab.

    SENDMAIL works fine with email_to,cc,message parameters.

    But when I include attachment (either varaiable or direct path - "ess/app/db/app.log"), I am not getting email eventhough jobs shows success status.

    Is there any way we can get essbase log with email as an attachment.



  • 2.  Attachment with mail

    Posted Oct 04, 2017 04:08 PM
    Theorically you can use a Notification object to send the mail ( notification type Email) with either the fulle path and file name or simply use the "external" file option after using the "REGISTER_OUTPUTFILE" command in your job that will link your file to the job. The Agent must have the information "MAIL" in the System Overview to allow this.

    I'm saying theorically as it depends on the version you are using and there is sometimes bugs in the connection between the Agent and the Server that makes it impossible to use. Be careful when doing this in production, you may need to stop/restart Agent to rebuild a normal communication channel.


  • 3.  Attachment with mail

    Posted Oct 04, 2017 04:23 PM
    Be absolutely sure you've provided the correct path and file name to your attachment.  

    The send_mail() function also gives you a return code.  I usually display that return code after every send_mail() function call.   
         :set &RC# = send_mail()
         :print "Email RC=&RC#"

    Zeros means it worked.  50014 means it could not find the attachment.  There is a list of common return codes here;
    https://docs.automic.com/documentation/WEBHELP/English/AWA/11.2/AE/11.2/All%20Guides/help.htm#ucaapv.htm?Highlight=send_mail

    If it gives you a 50014, it could be that your path is wrong, your file name is wrong, or you are trying to access the file with credentials that do not have rights to the folder.


  • 4.  Attachment with mail

    Posted Oct 04, 2017 04:37 PM
    Hi Pete Wirfs,

    I get 50014,but the path is actual path of log file "/ess/app/db/app.log"

    And this code is included in UNIX job which is connected to Essbase agent. Is there anything that I am missing


  • 5.  Attachment with mail

    Posted Oct 04, 2017 04:58 PM
    MDB629820,

    Check also following discussion. It may clarify question how attachments send using SEND_MAIL (default setting on AE it is executed on the server where AE is installed, so if the file is on different server then it will not find it)

    https://community.automic.com/discussion/6651/send-mail-with-option-agent-login-object#latest



  • 6.  Attachment with mail

    Posted Oct 04, 2017 05:35 PM
    I think Vlad may have found the issue.  However there are optional parameters to the send_mail() function to tell it which agent it should be executed from, and with what credentials.  I wonder if that might resolve it?


  • 7.  Attachment with mail

    Posted Oct 04, 2017 07:56 PM
    One solution is to put the file you want to send on a shared drive that the user that runs the Automation Engine can access.


  • 8.  Attachment with mail

    Posted Oct 05, 2017 08:00 AM
    I have created login object for Essbase and added in send_mail function

    SEND_MAIl(&SupportDL#,,&SUBJECT#,&MESSAGE#,"ess/app/db/app.log",,&LOGIN#)
     but still see 50014 code

    Any suggestions please



  • 9.  Attachment with mail

    Posted Oct 05, 2017 08:16 AM
    I have created login object for Essbase and added in send_mail function
    => I am afraid that won't solve your issue!

    I personally only use OS function to send mails with attachments. With that I am on the safe side that Attachments will be sent!


  • 10.  Attachment with mail

    Posted Oct 05, 2017 09:33 AM
    Hi Bruckler,

    Can you please elaborate on OS function


  • 11.  Attachment with mail

    Posted Oct 06, 2017 03:21 AM
    here you go:

    Powershell version mentioned here:
    https://community.automic.com/discussion/comment/26623#Comment_26623





  • 12.  Attachment with mail

    Posted Oct 06, 2017 03:41 AM
    and here is the mailx version...

    :SET &NL# = UC_CRLF()
    :SET &MESSAGE# = "Yoho I am an email sent with mailx on &$AGENT#&NL#"
    :SET &SUBJECT# = "Test email via &$AGENT#"
    :SET &FILE# = "/tmp/testfile.txt"

    echo ls &FILE# || exit 55
    ls &FILE# || exit 55


    :SET &NL# = UC_CRLF()
    :SET &MESSAGE# = "Yoho I am an email sent with mailx on &$AGENT#&NL#"
    :SET &SUBJECT# = "Test email via &$AGENT#"
    :SET &FILE# = "/tmp/testfile.txt"

    echo ls &FILE# || exit 55
    ls &FILE# || exit 55


    (echo "&MESSAGE#") | mailx -v \
    -r "uc4@local.com" \
    -s "&SUBJECT#" \
    -S smtp="XX.XX.XX.XX:587" \
    ! -S smtp-use-starttls \
    -S smtp-auth=login \
    -S smtp-auth-user="uc4@local.com" \
    -S smtp-auth-password="supermegasecret" \
    -S ssl-verify=ignore \
    -a &FILE# \
    uc4@local.com

    I had to comment the following line because of my mail server setup....
    ! -S smtp-use-starttls