This is not really a oorexx question but rather a java question.  However,
I see where your program is constructing the message you wish to send, but
I'm not seeing any place in your code where you actually send the message.

Rick

On Mon, Jan 26, 2015 at 11:01 AM, Florian Jedamzik <flo.jedam...@gmail.com>
wrote:

> Dear ooRexx - Users,
>
> We are 2 students of the University of Economics Vienna and we are currently 
> doing a
> Project with Open Object Rexx.
>
> We wish to send an E-Mail to a entered E-Mail Adress (you can see that in the 
> Code posted below),
> but it does not work.
>
> Do you have any Idea how to handle that Problem?
>
> Our program Creates an Open Office Document that get saved to the user's home 
> directory
> and should then be sended via E-Mail to the entered E-Mail Adress. Here is 
> where
> our problem is: it is not working...
>
> If you have any Ideas, please let us know, you are helping 2 Students that
> are just days away from receiving thei Bachelor's degree... ;)
>
> Kind Regards
>
> Florian Jedamzik & Eric Bruch
>
> P.S.: you can answer us to this E-Mail: h0965...@wu.ac.at
> or this one: flo.jedam...@gmail.com
>
>
>
>
>
>
>
> #!/usr/bin/rexx
>
> If arg(1)='?' Then Do
> Parse Source source
> Say source
> Say 'Create a window with a choice-object and two text-fields and buttons;'
> Say ' if the ok-button is pressed then popup another window and display'
> Say ' what was chosen and entered, respectively.'
> Exit
> End
>
> if BsfInvokedBy()=1 then say "This Rexx program was invoked by Java!"
> else if BsfInvokedBy()=2 then say "This Rexx program was invoked by Rexx, JVM 
> loaded by Rexx!"
> else say "No JVM present, we got troubles ..."
>
> /* create userData for use with the Greetings routine and event handlers;
> this allows us to access the registered objects */
>
> userData=.directory~new
>
> rexxCloseEH=.RexxCloseAppEventHandler~new -- create Rexx event handler
> -- create a RexxProxy for our Rexx event handler
> rpCloseEH=BsfCreateRexxProxy(rexxCloseEH, , "java.awt.event.ActionListener", -
> "java.awt.event.WindowListener")
>
> /* create Object Rexx prox-classes for the following "java"-classes: */
> .BSF~bsf.import('java.awt.Button' , 'awtButton' )
> .BSF~bsf.import('java.awt.Choice' , 'awtChoice' )
> .BSF~bsf.import('java.awt.Color' , 'awtColor' )
> .BSF~bsf.import('java.awt.Frame' , 'awtFrame' )
> .BSF~bsf.import('java.awt.GridLayout', 'awtGridLayout' )
> .BSF~bsf.import('java.awt.Label' , 'awtLabel' )
> .BSF~bsf.import('java.awt.TextField' , 'awtTextField' )
>
> /* create 4 labels */
> label1 = .awtLabel~new('Matrikelnummer: ')
> label2 = .awtLabel~new('Passwort: ')
> label3 = .awtLabel~new('Meinung zum Leben: ')
> label4 = .awtLabel~new('e-mail Adresse: ')
>
>
> /* create 4 textfields */
> matrikelnummer = .awtTextField~new
> passwort = .awtTextField~new
> meinungZumLeben = .awtTextField~new
> eMailAdresse = .awtTextField~new
>
>
> /* create userData for use with the Email routine;
> this allows us to access the registered objects */
> userData~Matrikelnummer = Matrikelnummer -- register Matrikelnummer object
> userData~Passwort = Passwort -- register Passwort object
> userData~meinungZumLeben = meinungZumLeben -- register meinungZumLeben object
> userData~eMailAdresse = eMailAdresse -- register eMailAdresse object
>
> /* create 2 buttons and add addEventListeners to them */
> oK = .awtButton~new('OK send e-Mail')
> rpOk=BsfCreateRexxProxy(.RexxOkHandler~new, userData, 
> "java.awt.event.ActionListener")
> ok~addActionListener(rpOk)
>
> cancel = .awtButton~new('Cancel')
> cancel~addActionListener(rpCloseEH)
>
>
> /* set the window layout */
> -- Background = .awtColor~new(150, 150, 250)
> background = .awtColor~newStrict("int", 200, "int", 200, "int", 200)
> gLayout = .awtGridLayout~new(5, 2)
> window = .awtFrame~new('der T-RexXx')
> window~addWindowListener(rpCloseEH)
>
> /* add all the elements to the window */
> window~setLayout(GLayout)
> window~~add(Label1)~~add(matrikelnummer)
> window~~add(Label2)~~add(passwort)
> window~~add(Label3)~~add(meinungZumLeben)
> window~~add(Label4)~~add(eMailAdresse)
> window~~add(OK) ~~add(Cancel)
> window~setSize(500, 500)
> window~setBackground(Background)
> window~~pack~~setVisible(.true)~~toFront
>
> /* no access needed anymore, free the references to
> the objects (just to demonstrate this feature) */
> drop label1
> drop label2
> drop label3
>
> rexxCloseEH~waitForExit -- wait until we are allowed to end the program
> window~dispose -- dispose of the Window
>
> -- if Java was loaded by Rexx, then terminate Java's RexxEngine to inhibit 
> callbacks from Java
> call BSF.terminateRexxEngine
>
>
> ::REQUIRES BSF.CLS -- get the Java support
>
> --write in open office and save
> ::ROUTINE Email
> -- Erstelle ODT Datei und verschicke diese
> use arg userData --stores the objects to get to the gender and names
>
> -- say 'hello'
> -- b = userData~meinungZumLeben~getText -- get Text of meinungZumLeben
> -- say b
>
> --retrieve Desktop object, we need its XComponentLoader interface to load a 
> new document
> xDesktop = UNO.createDesktop()
> xComponentLoader = xDesktop~XComponentLoader
>
> --create a new writer document
> url = "private:factory/swriter"
> writerComponent = xComponentLoader~loadComponentFromURL(url, "_blank", 0, 
> .UNO~noProps)
>
> --get the Text object
> xText = writerComponent~XTextDocument~getText
>
> --create a text-cursor, fetch a word cursor of it as well
> xTextCursor = xText~createTextCursor
> xWordCursor = xTextCursor~XWordCursor
>
> --create the Cursor Property
> xTextCursorProps = xTextCursor~XPropertySet
>
> --write meinungZumLeben
> xText~setString(b)
>
> --save swriter file
> userHome = .java.lang.System~getProperty("user.home") --home directory from 
> java
> fileName = "meinungZumLeben.ods" -- Name der Datei
> storeURL = uno.convertToURL(userHome"/"fileName)
> writerComponent~XStorable~storeAsURL(storeURL, .UNO~noProps)
> say "New document saved to" pp(uno.convertFromURL(storeURL))
>
> -- OO schließen
> writerComponent~dispose
>
> -- -------------------------- starte E-mail Programm 
> ----------------------------------------
>
> -- Konfigurierungsdaten
> to=userData~eMailAdresse~getText --get E-mail Adresse zu dem versendet 
> wirdfrom='h0965...@wu.ac.at' -- Florian Jedamzik
> host='mail.wu.ac.at' -- Host WU Wien
> subject='Lebenseinstellung' -- E-Mail Subject line
> text='T-RexXx!!!!'
>
> -- get Properties and set to smtp
> properties=.bsf~new('java.util.Properties')
> properties=BSF.import('java.lang.System')~getProperties()
> properties~setProperty('mail.smtp.host', host)
> session=BSF.import('javax.mail.Session')~getDefaultInstance(properties)
>
> --set session to send e-mail
> message=.bsf~new('javax.mail.internet.MimeMessage', session)
> message~setFrom(.bsf~new('javax.mail.internet.InternetAddress', from)) --set 
> from who message is
> toadress=.bsf~new('javax.mail.internet.InternetAddress', to) -- set where 
> message is going
>
> -- set TO Field for STMP Session
> message~addRecipient(BSF.getStaticValue('javax.mail.Message$RecipientType', 
> 'TO'), toadress)
> -- set SUBJECT for SMTP Session
> message~setSubject(subject)
> -- set MESSAGE TEXT for SMTP Session
> message~setText(text)
>
> multipart=BSF.import("javax.mail.internet.MimeMultipart")~new
> bodypart=BSF.import("javax.mail.internet.MimeBodyPart")~new
> attachment=BSF.import("javax.activation.FileDataSource")~new(storeURL)
>
> --attach object to e-mail
> handler=BSF.import("javax.activation.DataHandler")~new(attachment)
> bodypart~setDataHandler(handler)
> bodypart~setFileName(fileName)
> multipart~addBodyPart(bodypart)
> message~setContent(multipart)
>
>
> exit
>
> -- -------------------------- Ende e-mail Programm 
> ---------------------------------------------
> /*-- get file name and save OO file
> storeFileName = "meinungZumLeben.ods"
> storeURL = uno.convertToURL(userHome"/"storeFileName) -save in user home 
> folder
> writerComponent~XStorable~storeAsURL(storeURL, UNO~noProps)
> */
> ::requires UNO.CLS --get UNO support vereinte Nationen!!!!
>
> -- greet = .awtLabel~new /* create a label */
> -- bye = .awtButton~new('Bye!') /* create a button */
>
> /* add label and button to the window */
> -- window2~~add('North', greet)~~add('South', Bye)
> -- window2~~pack~~setVisible(.true)~~toFront
>
> /* now prepare to put something into that window */
> -- gender = userData~DropDown~getSelectedItem /* get chosen Item */
> -- n1 = userData~Name~getText /* get entered text */
> -- n2 = userData~Surname~getText /* get entered text */
>
> -- if Gender = "male" then Greet~setText('Hello Mr.' N1 N2)
> -- else Greet~setText('Hello Mrs.' N1 N2)
>
> -- rexxCloseEH=.RexxClosePopupEventHandler~new -- create Rexx event handler
> -- create a RexxProxy for our Rexx event handler
> -- rp=BsfCreateRexxProxy(rexxCloseEH, , "java.awt.event.ActionListener", -
> -- "java.awt.event.WindowListener")
> -- window2~addWindowListener(rp)
> -- bye~addActionListener(rp)
>
> -- rexxcloseEH~waitForExit -- wait until we are allowed to end the program
> -- window2~dispose -- dispose of this window
>
>
> /* ------------------------------------------------------------------------ */
> /* Rexx event handler to set "close app" indicator */
> ::class RexxCloseAppEventHandler
> ::method init /* constructor */
> expose closeApp
> closeApp = .false -- if set to .true, then it is safe to close the app
>
> ::attribute closeApp -- indicates whether app should be closed
>
> ::method unknown -- intercept unhandled events, do nothing
>
> ::method actionPerformed -- event method (from ActionListener)
> expose closeApp
> closeApp=.true -- indicate that the app should close
>
> ::method windowClosing -- event method (from WindowListener)
> expose closeApp
> closeApp=.true -- indicate that the app should close
>
> ::method waitForExit -- method blocks until attribute is set to .true
> expose closeApp
> guard on when closeApp=.true
>
>
> /* ------------------------------------------------------------------------ */
> /* Rexx event handler to process tab changes */
> ::class RexxOkHandler
>
> ::method actionPerformed
> use arg eventObject, slotDir
>
> reply -- do not block awt-thread, proceed execution on a new thread
> call Email slotDir~userData
>
>
> /* ------------------------------------------------------------------------ */
> /* Rexx event handler to set "close app" indicator */
> ::class RexxClosePopupEventHandler
> ::method init /* constructor */
> expose closeApp
> closeApp = .false -- if set to .true, then it is safe to close the app
>
> ::attribute closeApp -- indicates whether app should be closed
>
> ::method unknown -- intercept unhandled events, do nothing
>
> ::method actionPerformed -- event method (from ActionListener)
> expose closeApp
> closeApp=.true -- indicate that the app should close
>
> ::method windowClosing -- event method (from WindowListener)
> expose closeApp
> closeApp=.true -- indicate that the app should close
>
> ::method waitForExit -- method blocks until attribute is set to .true
> expose closeApp
> guard on when closeApp=.true
>
>
>
> ------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your
> hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
> _______________________________________________
> Oorexx-users mailing list
> Oorexx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
>
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to