Is it possible to send Notification from different user to that configured in UC_CLIENT_SETTINGS

Hi,
I have received a request to generate an email alert, but it needs to be sent as a different user to that configured in my UC_CLIENT_SETTINGS variable as SMTP_FROM_ADDR.

I'm using a NOTIFICATION and I tried this in my process tab but it doesn't allow this.

:SET &$SMTP_FROM_ADDR# = 'email.address'

I only want to send this one email alert as this user.
Anyone know if this is possible?

John.

Tagged:

Comments

  • Wolfgang BruecklerWolfgang Brueckler EXAutomicPosts: 663 Expert ✭✭✭✭✭
    Basically its not intended to change the SMTP_FROM_ADDR

    there is a "dark" workaround - i would not use in a PROD env....

    use put_var to change the default mail address beforehand
    :PUT_VAR UC_CLIENT_SETTINGS,"SMTP_FROM_ADDR",&NEWMAIL#
    then perform the send_mail or activate_uc_object (CALL.OBJ)
    then change it back to original value
    :PUT_VAR UC_CLIENT_SETTINGS,"SMTP_FROM_ADDR",&OLDMAIL#

    pls be careful using this.......
    Wolfgang Brückler
    Developer Lv. 3
    AE 11.2/ORA11G/Linux
  • John O'MullaneJohn O'Mullane Posts: 246 Journeyman ✭✭✭
    @Wolfgang Brueckler
    Thanks, I tried that in my dev enthronement  but it didn't work for some reason.

    I created a script to call my Notification as follows



    I'm definitely using SMTP_FROM_ADDR as I temporarily changed it manually and it did pick up my change.

    Not sure why the PUT_VAR didn't change it...

  • Wolfgang BruecklerWolfgang Brueckler EXAutomicPosts: 663 Expert ✭✭✭✭✭
    edited January 10
    had the same issue & behavior

    the trick is a wait between put_var and send_mail

    following script worked fine:

    :SET &NEWMAIL# = "V113@local.com"
    :SET &OLDMAIL# = "V112@local.com"

    :PUT_VAR UC_CLIENT_SETTINGS,"SMTP_FROM_ADDR",&NEWMAIL#
    :wait 5
    :SET &RET# = send_mail(uc4@local.com,,"TEST","TEXT")
    :P &RET#
    :wait 5
    :PUT_VAR UC_CLIENT_SETTINGS,"SMTP_FROM_ADDR",&OLDMAIL#

    think the 2nd wait is not really necessary....
    Wolfgang Brückler
    Developer Lv. 3
    AE 11.2/ORA11G/Linux
  • Wolfgang BruecklerWolfgang Brueckler EXAutomicPosts: 663 Expert ✭✭✭✭✭
    But be aware - if anyone within this client sends an email gets the same from address.....
    Wolfgang Brückler
    Developer Lv. 3
    AE 11.2/ORA11G/Linux
  • John O'MullaneJohn O'Mullane Posts: 246 Journeyman ✭✭✭
    Yes, that worked, thanks. I can see how it might be risky though so I might not use it...


  • Wolfgang BruecklerWolfgang Brueckler EXAutomicPosts: 663 Expert ✭✭✭✭✭
    Plan B could be creating a seperate forwarding mail address on your mailserver just for thos purpose.

    Plan C using a seperate client
    Wolfgang Brückler
    Developer Lv. 3
    AE 11.2/ORA11G/Linux
  • Pete WirfsPete Wirfs Software Engineer Salem OregonPosts: 899 Innovator ✭✭✭✭✭✭
    Plan D, send the email from an app that you execute.
    Pete
    AE 11.2.1
  • Wolfgang BruecklerWolfgang Brueckler EXAutomicPosts: 663 Expert ✭✭✭✭✭
    Thanks for the great idea @Pete Wirfs !!!

    Plan D1:
    Its working with powershell!

    Idea stolen from here:
    http://www.howtogeek.com/120011/stupid-geek-tricks-how-to-send-email-from-the-command-line-in-windows-without-extra-software/

    Win Job Content

    :begin_ext_int POWERSHELL
        $EmailFrom = "schubiduba@local.com"
        $EmailTo = "uc4@local.com"
        $Subject = "Its cold outside"
        $Body = "about -20 degrees. Brrrrrr."
        $SMTPServer = "127.0.0.1"
        $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
        $SMTPClient.EnableSsl = $false
        $SMTPClient.Credentials = New-Object System.Net.NetworkCredential("uc4", "uc4");
        $SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
    :END_EXT_INT


    Mail:


    Wolfgang Brückler
    Developer Lv. 3
    AE 11.2/ORA11G/Linux
  • John O'MullaneJohn O'Mullane Posts: 246 Journeyman ✭✭✭
    thanks @Peter Fruehwirt  and @Wolfgang Brueckler

    Plan D2 I think unix mailx world work something similar to windows powershell.

  • Wolfgang BruecklerWolfgang Brueckler EXAutomicPosts: 663 Expert ✭✭✭✭✭
    yes- should be the same - just on another OS.
    Wolfgang Brückler
    Developer Lv. 3
    AE 11.2/ORA11G/Linux
  • Wolfgang BruecklerWolfgang Brueckler EXAutomicPosts: 663 Expert ✭✭✭✭✭
    @John O'Mullane

    One more finding to our SMTP_FROM_ADDR entry in UC system settings.

    just found out - if you use the KEY SMTP_REPLY_TO you can change SMTP_FROM_ADDR as you wish - displayed  mail address is SMTP_FROM_ADDR but "used" or "real" mail address is KEY SMTP_REPLY_TO.

    So if you set KEY SMTP_REPLY_TO accordingly you can change SMTP_FROM_ADDR for just one job.

    Murphys law (a second user or job sends an email just by "accident" at exact the same time) will be sent to the correct mail address - the only "disadvantage" would be a wrong displyed mail address.




    Wolfgang Brückler
    Developer Lv. 3
    AE 11.2/ORA11G/Linux
  • John O'MullaneJohn O'Mullane Posts: 246 Journeyman ✭✭✭
    @Wolfgang Brueckler

    I'm not sure I fully understand...

    So, I added the key SMTP_REPLY_TO to my UC_CLIENT_SETTINGS VARA so that it now looks like this
    (I didn't have it set previously)



    When I now generate an email Notification without making any change to the SMTP_FROM_ADDR, the email is sent from wladev@xilinx.com, as I would expect.

    If I try to reply to this email, it now has johnom@xilinx.com in the from field, as opposed to noreply@uc4.com, which I also expect.

    I don't understand how setting this will help me here...



  • Wolfgang BruecklerWolfgang Brueckler EXAutomicPosts: 663 Expert ✭✭✭✭✭
    my intention was to ensure that a replied email always goes to the "real" mailaddress SMTP_FROM_ADDR

    example:
    my: UC_CLIENT_SETTINGS

    SMTP_FROM_ADDR V112@local.com




    SMTP_REPLY_TO V112@local.com




    I want to ensure that V112@local.com is my standard mailaddress.

    If you want to send it with another mailaddress in FROM - you change the SMTP_FROM_ADDR - so even if you answer the email, it returns to V112@local.com.



    Hope it wasn´t a misunderstanding of your comment :-)

    Wolfgang Brückler
    Developer Lv. 3
    AE 11.2/ORA11G/Linux
  • John O'MullaneJohn O'Mullane Posts: 246 Journeyman ✭✭✭
    @Wolfgang Brueckler

    Ok, thanks. I understand now.
    It's not really the reply I'm worried about.
    This email is coming from a senior director. I can't take the risk, small as they are, of a general email being sent as this user.

    I think I can use Mailx to get this done.

    Thanks, anyway.
  • Wolfgang BruecklerWolfgang Brueckler EXAutomicPosts: 663 Expert ✭✭✭✭✭
    @John O'Mullane

    ohh one should not play tricks (intended or per accident) with a senior director.
    so mailx is the "most safe" solution.

    on the other hand it could be funny sending a mail from the senior director - from mail address to everyone at your company starting with the words "I proudly present the employee of the decade - John O' Mullane ......"

    ;)
    Wolfgang Brückler
    Developer Lv. 3
    AE 11.2/ORA11G/Linux
  • John O'MullaneJohn O'Mullane Posts: 246 Journeyman ✭✭✭
    :smiley:
Sign In or Register to comment.