Source Code Cross Referenced for MailProc.java in  » Workflow-Engines » shark » email » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » shark » email 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package email;
02:
03:        import org.enhydra.shark.api.internal.toolagent.AppParameter;
04:
05:        import java.util.Properties;
06:        import javax.mail.*;
07:        import javax.mail.internet.*;
08:
09:        /** MailProc sends an e-mail using specified parameters:
10:         *
11:         *  param1 - text_msg         The text of the message
12:         *  param2 - subject       Subject of the e-mail
13:         *  param3 - source_address      Address of the sender (XXX@XXXX.XXX)
14:         *  param4 - destination_address Address of the receiver (XXX@XXXX.XXX)
15:         *  param5 - user       If the server requires athentication
16:         *             Can be an empty string ""
17:         *  param6 - password         Password the user needs to authenticate
18:         *             Can be an empty string ""
19:         *  param7 - server        IP address of de server
20:         *  param8 - port       Number of the port (usually 25)
21:         *
22:         *  @throws MessagingException      If exists an error while sending the message
23:         *
24:         *  @author Paloma Trigueros Cabezon
25:         *  @version 1.0
26:         */
27:
28:        public class MailProc {
29:            public static void execute(AppParameter param1,
30:                    AppParameter param2, AppParameter param3,
31:                    AppParameter param4, AppParameter param5,
32:                    AppParameter param6, AppParameter param7,
33:                    AppParameter param8) {
34:                try {
35:                    System.out.println("Beginning MailProc...");
36:
37:                    //Extracting parameters
38:                    System.out.println("Extracting parameters...");
39:
40:                    /*  This is an example of how to send a number (the result of
41:                    a calculation, for example) as the text of the message:
42:                       long text      = param1.extract_longlong();
43:                       Long t         = new Long(text);
44:                       String text_msg   = t.toString(text);
45:                     */
46:
47:                    String text_msg = param1.the_value.toString();
48:                    String subject = param2.the_value.toString();
49:                    String source_address = param3.the_value.toString();
50:                    String destination_address = param4.the_value.toString();
51:                    String user = param5.the_value.toString();
52:                    String password = param6.the_value.toString();
53:                    String server = param7.the_value.toString();
54:                    long port = ((Long) param8.the_value).longValue();
55:
56:                    // Get system properties
57:                    Properties props = new Properties();
58:
59:                    // Setup mail server
60:                    props.put("mail.smtp.host", server);
61:                    props.put("mail.smtp.port", "" + port);
62:
63:                    // User name
64:                    props.put("mail.smtp.user", user);
65:                    props.put("mail.smtp.auth", "true");
66:
67:                    // Get session
68:                    javax.mail.Session session = Session.getInstance(props,
69:                            new SmtpAuthenticator(user, password));
70:
71:                    // Define message
72:                    MimeMessage message = new MimeMessage(session);
73:
74:                    message.setFrom(new InternetAddress(source_address));
75:
76:                    message.addRecipient(Message.RecipientType.TO,
77:                            new InternetAddress(destination_address));
78:
79:                    message.setSubject(subject);
80:
81:                    message.setContent(text_msg, "text/plain");
82:
83:                    // Send message
84:                    Transport.send(message);
85:
86:                } catch (Exception ex) {
87:                    System.out
88:                            .println("MailProc - Problems during execution of MailProc"
89:                                    + ex);
90:                }
91:                System.out.println("Finishing MailProc...");
92:            }
93:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.