Make Notifications by email in Genexus 15

0

How are they? I would like to ask you what is the usual protocol or method, by which you normally make email notifications in Genexus, I am working in Genexus 15 U9, Java generator. From already thank you very much!! Greetings !!

    
asked by Gustavo Centurión 24.08.2018 в 15:50
source

1 answer

0

In GeneXus you have the data type SMTPSession available Allows you to send e-mails.

For example, in this way (*):

Event 'Send'
    &AddressTo.Address = 'isidoro@cañones.com'
    &AddressTo.Name = 'Isidoro Cañones'
    &Send.To.Clear()
    &Send.To.Add(&AddressTo)

    &Send.Subject = 'You’re invited to my party'
    &Send.HTMLText = 'Next Saturday I celebrate my birthday, do not miss it!'

    // The SMTP server used in this case does not need authentication.
    &MessageSMTP.Host = 'SMTP Server'

    &MessageSMTP.Sender.Name = 'Patoruzu'
    &MessageSMTP.Sender.Address = '[email protected]'

    &MessageSMTP.Authentication = 1
    &MessageSMTP.UserName = 'My user'
    &MessageSMTP.Password = 'My password'
    &MessageSMTP.Login()

    &MessageSMTP.Send(&Send) 

    if &MessageSMTP.ErrCode <> 0
        msg(&MessageSMTP.ErrDescription)
    endif   
    &MessageSMTP.Logout()
EndEvent

(*) example taken from the document Data Types for Email handling (in English, not official ...)

    
answered by 31.08.2018 в 15:26