Forum Stats

  • 3,838,652 Users
  • 2,262,389 Discussions
  • 7,900,718 Comments

Discussions

How to send an email from the HFM Rules

Bulent.Yildiz-Oracle
Bulent.Yildiz-Oracle Member Posts: 9
edited Mar 28, 2019 6:20AM in Financial Consolidation

Hi experts,

Has anyone achieved this On-Prem or OMCS? I am planning to trigger this using an on-demand rule, but not sure where to start.

Thanks to all for any ideas, opinions, recommendations and working solutions you may have.

Bulent

Tagged:
Bulent.Yildiz-OracleSundeep V

Best Answer

  • user6692921
    user6692921 Member Posts: 179 Silver Badge
    edited Feb 17, 2019 7:57AM Answer ✓

    Hi Bulent

    This is the code I use for sending an email from the Allocate function:

               intSendUsing = 2

                intSMTPPort = 25

       

                ' Don't want any errors to hold up the process

                On Error Resume Next

                   

                'Create CDO configuration object

                Set objConfig = CreateObject("CDO.Configuration")

                'Set Config object settings

                With objConfig.Fields

                    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = intSendUsing

                    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPServer

                    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = intSMTPPort

                    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10

                    .Update

                End With

       

                'Create CDO message object

                Set objMsg = CreateObject("CDO.Message")

                'Assign config object to configuration property of message object

                Set objMsg.Configuration = objConfig

                'Set Message object settings and send mail

                With objMsg

                    .To = strToAddress

                    .CC = strCCAddress

                    .From = strFromAddress

                    .Subject = strSubject

                    .TextBody = strEmailMsgLine

                    .Send

                End With

               

                'Destroy message objects

                Set objMsg = Nothing

                Set objConfig = Nothing

    Bulent.Yildiz-OracleBulent.Yildiz-Oracle

Answers

  • ericerikson
    ericerikson Member Posts: 608 Bronze Trophy
    edited Feb 16, 2019 3:43PM

    Hi. Suggest you search on Amazon.

    Eric

    Bulent.Yildiz-Oracle
  • user6692921
    user6692921 Member Posts: 179 Silver Badge
    edited Feb 17, 2019 7:57AM Answer ✓

    Hi Bulent

    This is the code I use for sending an email from the Allocate function:

               intSendUsing = 2

                intSMTPPort = 25

       

                ' Don't want any errors to hold up the process

                On Error Resume Next

                   

                'Create CDO configuration object

                Set objConfig = CreateObject("CDO.Configuration")

                'Set Config object settings

                With objConfig.Fields

                    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = intSendUsing

                    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTPServer

                    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = intSMTPPort

                    .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10

                    .Update

                End With

       

                'Create CDO message object

                Set objMsg = CreateObject("CDO.Message")

                'Assign config object to configuration property of message object

                Set objMsg.Configuration = objConfig

                'Set Message object settings and send mail

                With objMsg

                    .To = strToAddress

                    .CC = strCCAddress

                    .From = strFromAddress

                    .Subject = strSubject

                    .TextBody = strEmailMsgLine

                    .Send

                End With

               

                'Destroy message objects

                Set objMsg = Nothing

                Set objConfig = Nothing

    Bulent.Yildiz-OracleBulent.Yildiz-Oracle
  • Bulent.Yildiz-Oracle
    Bulent.Yildiz-Oracle Member Posts: 9
    edited Mar 27, 2019 7:48PM

    Hello,

    Thank you for this. Using the CDO method, do you know if the email goes through the Microsoft servers? This may be a problem if I need to include some financial figures in the email.

    Regards

    Bulent

  • Bulent.Yildiz-Oracle
    Bulent.Yildiz-Oracle Member Posts: 9
    edited Mar 27, 2019 7:55PM

    Hi Eric,

    I have seen your book about sending emails from HFM rules on Amazon. I have found some code on the internet (CDO / Outlook object) alsouser6692921 shared a sample code using CDO object. Is your book offering any other useful information and/or methods? I am happy to purchase it if it does. I'd appreciate if you could let me know.

    Thanks

    Bulent

  • user6692921
    user6692921 Member Posts: 179 Silver Badge
    edited Mar 28, 2019 4:31AM

    Hi Bulent

    The email will not go through Microsoft servers unless your SMTP server is a Microsoft server. SMTP is essentially a folder which is monitored by the SMTP service. An SMTP email is a file in a particular format which is copied to a set folder on the SMTP Server. The SMTP Service picks up the file and reads the email properties and then sends the email from the server itself.

    SMTP does not require any software installation as it is a folder that is being monitored. If you want to go down the Outlook route you will need to have mail client software installed i.e. you need to install Outlook on your HFM servers. Or replicate the SMTP setup by copying the email as a text file to another server which has Outlook installed and monitor the folder.

    HTH

    Bulent.Yildiz-OracleBulent.Yildiz-Oracle
  • Bulent.Yildiz-Oracle
    Bulent.Yildiz-Oracle Member Posts: 9
    edited Mar 28, 2019 6:20AM

    Thanks HTH,

    This is good to hear. It would be great to have some kind of proof of this (e.g. a document or website explaining how CDO works). I have googled for this but couldn't find much about how the data (email and config data) flows using CDO.

    Code like "http://schemas.microsoft.com/cdo/configuration"  may make it look like some of the information is being recorded in the Microsoft databases. 

    Regards

    Bulent