diff --git a/Build/build/build.xml b/Build/build/build.xml index 3911ab52f12..fa0a9c63b2a 100644 --- a/Build/build/build.xml +++ b/Build/build/build.xml @@ -240,7 +240,7 @@ - + diff --git a/Frameworks/Mail/ERJavaMail/.WOLips b/Frameworks/Mail/ERJavaMail/.WOLips deleted file mode 100644 index c05f3350605..00000000000 --- a/Frameworks/Mail/ERJavaMail/.WOLips +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Frameworks/Mail/ERJavaMail/.classpath b/Frameworks/Mail/ERJavaMail/.classpath deleted file mode 100644 index cfcdb66ef63..00000000000 --- a/Frameworks/Mail/ERJavaMail/.classpath +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Frameworks/Mail/ERJavaMail/.gitignore b/Frameworks/Mail/ERJavaMail/.gitignore deleted file mode 100644 index fcc7e7a559b..00000000000 --- a/Frameworks/Mail/ERJavaMail/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -target -bin -build -*.xcodeproj -*.pbxproj -ant.* \ No newline at end of file diff --git a/Frameworks/Mail/ERJavaMail/.project b/Frameworks/Mail/ERJavaMail/.project deleted file mode 100644 index e5b4b581470..00000000000 --- a/Frameworks/Mail/ERJavaMail/.project +++ /dev/null @@ -1,24 +0,0 @@ - - - ERJavaMail - - - ERExtensions - - - - org.eclipse.jdt.core.javabuilder - - - - - org.objectstyle.wolips.incrementalbuilder - - - - - - org.eclipse.jdt.core.javanature - org.objectstyle.wolips.incrementalframeworknature - - diff --git a/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.core.resources.prefs b/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 99f26c0203a..00000000000 --- a/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -encoding/=UTF-8 diff --git a/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.core.runtime.prefs b/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.core.runtime.prefs deleted file mode 100644 index 5a0ad22d2a7..00000000000 --- a/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.core.runtime.prefs +++ /dev/null @@ -1,2 +0,0 @@ -eclipse.preferences.version=1 -line.separator=\n diff --git a/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.jdt.core.prefs b/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 068b7241593..00000000000 --- a/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,257 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.8 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 -org.eclipse.jdt.core.formatter.align_type_members_on_columns=false -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 -org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 -org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 -org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 -org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 -org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 -org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 -org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_field=0 -org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 -org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 -org.eclipse.jdt.core.formatter.blank_lines_before_method=1 -org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 -org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line -org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false -org.eclipse.jdt.core.formatter.comment.format_comments=true -org.eclipse.jdt.core.formatter.comment.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true -org.eclipse.jdt.core.formatter.comment.indent_root_tags=true -org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert -org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert -org.eclipse.jdt.core.formatter.comment.line_length=120 -org.eclipse.jdt.core.formatter.compact_else_if=true -org.eclipse.jdt.core.formatter.continuation_indentation=2 -org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 -org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true -org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true -org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_empty_lines=false -org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true -org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false -org.eclipse.jdt.core.formatter.indentation.size=4 -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert -org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert -org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert -org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert -org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert -org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert -org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false -org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false -org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false -org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=999 -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=tab -org.eclipse.jdt.core.formatter.tabulation.size=4 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false diff --git a/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.jdt.ui.prefs b/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index 7d45b4910cc..00000000000 --- a/Frameworks/Mail/ERJavaMail/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Thu Oct 19 15:58:36 EDT 2006 -eclipse.preferences.version=1 -formatter_profile=_Project Wonder -formatter_settings_version=10 -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=java;javax;org;com; -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.staticondemandthreshold=99 diff --git a/Frameworks/Mail/ERJavaMail/Libraries/activation-1.1.1.jar b/Frameworks/Mail/ERJavaMail/Libraries/activation-1.1.1.jar deleted file mode 100644 index 29a59a9ee19..00000000000 Binary files a/Frameworks/Mail/ERJavaMail/Libraries/activation-1.1.1.jar and /dev/null differ diff --git a/Frameworks/Mail/ERJavaMail/Libraries/dsn-1.5.4.jar b/Frameworks/Mail/ERJavaMail/Libraries/dsn-1.5.4.jar deleted file mode 100644 index ab0d563af14..00000000000 Binary files a/Frameworks/Mail/ERJavaMail/Libraries/dsn-1.5.4.jar and /dev/null differ diff --git a/Frameworks/Mail/ERJavaMail/Libraries/javax.mail-1.5.4.jar b/Frameworks/Mail/ERJavaMail/Libraries/javax.mail-1.5.4.jar deleted file mode 100644 index f38b82c39de..00000000000 Binary files a/Frameworks/Mail/ERJavaMail/Libraries/javax.mail-1.5.4.jar and /dev/null differ diff --git a/Frameworks/Mail/ERJavaMail/Libraries/mockmail.jar b/Frameworks/Mail/ERJavaMail/Libraries/mockmail.jar deleted file mode 100644 index 9e6f17e4b30..00000000000 Binary files a/Frameworks/Mail/ERJavaMail/Libraries/mockmail.jar and /dev/null differ diff --git a/Frameworks/Mail/ERJavaMail/LibraryJavadocs/dsn-1.5.4-javadoc.jar b/Frameworks/Mail/ERJavaMail/LibraryJavadocs/dsn-1.5.4-javadoc.jar deleted file mode 100644 index c43c8e49b72..00000000000 Binary files a/Frameworks/Mail/ERJavaMail/LibraryJavadocs/dsn-1.5.4-javadoc.jar and /dev/null differ diff --git a/Frameworks/Mail/ERJavaMail/LibraryJavadocs/javax.mail-1.5.4-javadoc.jar b/Frameworks/Mail/ERJavaMail/LibraryJavadocs/javax.mail-1.5.4-javadoc.jar deleted file mode 100644 index eae607345ea..00000000000 Binary files a/Frameworks/Mail/ERJavaMail/LibraryJavadocs/javax.mail-1.5.4-javadoc.jar and /dev/null differ diff --git a/Frameworks/Mail/ERJavaMail/LibrarySources/dsn-1.5.4-sources.jar b/Frameworks/Mail/ERJavaMail/LibrarySources/dsn-1.5.4-sources.jar deleted file mode 100644 index 73a5163cd44..00000000000 Binary files a/Frameworks/Mail/ERJavaMail/LibrarySources/dsn-1.5.4-sources.jar and /dev/null differ diff --git a/Frameworks/Mail/ERJavaMail/LibrarySources/javax.mail-1.5.4-sources.jar b/Frameworks/Mail/ERJavaMail/LibrarySources/javax.mail-1.5.4-sources.jar deleted file mode 100644 index 2a642ba1d07..00000000000 Binary files a/Frameworks/Mail/ERJavaMail/LibrarySources/javax.mail-1.5.4-sources.jar and /dev/null differ diff --git a/Frameworks/Mail/ERJavaMail/Resources/Properties b/Frameworks/Mail/ERJavaMail/Resources/Properties deleted file mode 100644 index a4c0728124e..00000000000 --- a/Frameworks/Mail/ERJavaMail/Resources/Properties +++ /dev/null @@ -1,59 +0,0 @@ -## Properies Info -er.extensions.load.Properties.framework.ERJavaMail=load -er.extensions.ERJavaMail.hasLocalization=false - -# *** ERJavaMail settings -# *** Defaults to 'safe' settings: -# *** - -# Sometimes when sending big masses of emails, the java virtual machine -# doesn't collects correctly the garbage and needs a little delay -# between each message sending. Use this option if you have problem with -# memory management -er.javamail.useSenderDelay = false - -# This delay is set to 15 milliseconds -er.javamail.senderDelayMillis = 15 - -# * Default encoding used for ERJavaMail -er.javamail.defaultEncoding = iso-8859-1 - -# * Enables ERJavaMail to send all the mails to only one destination -# This is useful when debugging -er.javamail.centralize = true - -# * Prints javamail debug infos -# It is recommended to activate this switch when there are problems -# with smtp configuration -er.javamail.debugEnabled = false - -# * The admin email, this is where "centralized" mails will go -#er.javamail.adminEmail = user@domain.com - -# * SMTP outbound host -#er.javamail.smtpHost = smtp.domain.com - -# Valid ERJavaMail email pattern. If null, then the internal default will be used -#er.javamail.emailPattern = ^.*?@.*$ - -# * Number of messages that the sender queue can hold at a time -er.javamail.senderQueue.size = 50 - -# * Time to wait when mail sender queue is overflowed -er.javamail.milliSecondsWaitIfSenderOverflowed = 6000 - -# Used to set a default X-Mailer -#er.javamail.mailer.XMailerHeader = - -# White and black email address patterns -# This can be useful in testing when say -# you only want to allow emails to be sent to *@mycompany.com -# In this case you would add: -# er.javamail.WhiteListEmailAddressPatterns=("*@mycompany.com", "somebody@mac.com") - -# To prevent sending mail to certain addresses you can use the black list -# er.javamail.BlackListEmailAddressPatterns=("*@baddomain.com", "badperson@mycompany.com") - - -# * The port to use with the smtp server, if not set, defaults to 25 -#er.javamail.smtpPort = 25 \ No newline at end of file diff --git a/Frameworks/Mail/ERJavaMail/Resources/_Properties_ja b/Frameworks/Mail/ERJavaMail/Resources/_Properties_ja deleted file mode 100644 index 4538d61923c..00000000000 --- a/Frameworks/Mail/ERJavaMail/Resources/_Properties_ja +++ /dev/null @@ -1,74 +0,0 @@ -## ONLY FOR DOCUMENTATION -## -## 実際は Properties ファイルを使用して設定を行います。 -## このファイルは説明用です。 -## 忘れずに:er.javamail.defaultEncoding=UTF-8 を設定してください。 -##================================================================= - -## SMTP 送信に認証が必要かどうかをセットします。 -## true の場合には下記のユーザとパスワード情報もセットする必要があります。 -# er.javamail.smtpAuth=false - -## SMTP サーバへの認証ログインのユーザ名 -# er.javamail.smtpUser=smtpusername - -## SMTP サーバへの認証ログインのパスワード -# er.javamail.smtpPassword=smtppassword - -## メッセージ・コンテントに使用するデフォルト・エンコーディング -er.javamail.defaultEncoding = iso-8859-1 - -## すべてのメールを wodka.javamail.adminEmail ユーザに送信します。(デバッグ中に便利) -er.javamail.centralize = true - -## メール・デバッグ情報を表示するかどうか。プロトコル・レベル情報を含む -## SMTP 設定時に問題がある場合、これを true するといいのです。 -er.javamail.debugEnabled = false - -## 必須項目:"centralize" メールの送り先メール・アドレス -#er.javamail.adminEmail = user@domain.com - -## SMTP 送信ホスト -## セットされててない場合には WOHost へ送信が行われる -#er.javamail.smtpHost = smtp.domain.com - -## 検証に使用する ERJavaMailメール・パタン。 null の場合には内部のパタンが使用される -#er.javamail.emailPattern = ^.*?@.*$ - -## 送信キューが保持できるメッセージ・サイズ -## セットされていない場合には 50 が使用されます。 -er.javamail.senderQueue.size = 50 - -## 送信キューが一杯時に待つミリ秒。デフォルトは 6000 -er.javamail.milliSecondsWaitIfSenderOverflowed = 6000 - -## すべての送信メッセージに追加する X-Mailer header -#er.javamail.mailer.XMailerHeader = - -## ホワイト&ブラック・リスト・メールアドレス・パタン -## 例えば、テスト中で *@mycompany.com にしかメールを送信したい場合 -## コンマ区切りされているメールアドレス・パタンのホワイト・リスト -## セットされている場合にはホワイト・リストに含まれるメールしか送信されません。 -## パタン・シンタクスは EOQualifier caseInsensitiveLike 同様 -## この場合には次の様に追加します: -# er.javamail.WhiteListEmailAddressPatterns=("*@mycompany.com", "somebody@mac.com") - -## 送信したくないアドレスがある場合にはブラック・リストを使用できます。 -## コンマ区切りされているメールアドレス・パタンのブラック・リスト -## セットされているアドレスへはメール送信されません。 -## パタン・シンタクスは EOQualifier caseInsensitiveLike 同様 -## ブラック・リスト・パタンは最後に処理されるので、ホワイト・リストよりも優先です。 -# er.javamail.BlackListEmailAddressPatterns=("*@baddomain.com", "badperson@mycompany.com") - -## SMTP 送信ポート -## セットされていない場合には 25 が使用されます。 -#er.javamail.smtpPort = 25 - -# Sometimes when sending big masses of emails, the java virtual machine -# doesn't collects correctly the garbage and needs a little delay -# between each message sending. Use this option if you have problem with -# memory management -er.javamail.useSenderDelay = false - -# This delay is set to 15 milliseconds -er.javamail.senderDelayMillis = 15 diff --git a/Frameworks/Mail/ERJavaMail/Resources/mime.types b/Frameworks/Mail/ERJavaMail/Resources/mime.types deleted file mode 100644 index 860f386c5b5..00000000000 --- a/Frameworks/Mail/ERJavaMail/Resources/mime.types +++ /dev/null @@ -1,404 +0,0 @@ -# This is a comment. I love comments. - -# This file controls what Internet media types are sent to the client for -# given file extension (s). Sending the correct media type to the client -# is important so they know how to handle the content of the file. -# Extra types can either be added here or by using an AddType directive -# in your config files. For more information about Internet media types, -# please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type -# registry is at . - -# MIME type Extension -application/EDI-Consent -application/EDI-X12 -application/EDIFACT -application/activemessage -application/andrew-inset ez -application/applefile -application/atomicmail -application/batch-smtp -application/cals-1840 -application/commonground -application/cybercash -application/dca-rft -application/dec-dx -application/eshop -application/http -application/hyperstudio -application/iges -application/index -application/index.cmd -application/index.obj -application/index.response -application/index.vnd -application/iotp -application/ipp -application/mac-binhex40 hqx -application/mac-compactpro cpt -application/macwriteii -application/marc -application/mathematica -application/mathematica-old -application/msword doc -application/news-message-id -application/news-transmission -application/ocsp-request -application/ocsp-response -application/octet-stream bin dms lha lzh exe class -application/oda oda -application/pdf pdf -application/pgp-encrypted -application/pgp-keys -application/pgp-signature -application/pkcs10 -application/pkcs7-mime -application/pkcs7-signature -application/pkix-cert -application/pkix-crl -application/pkixcmp -application/postscript ai eps ps -application/prs.alvestrand.titrax-sheet -application/prs.cww -application/prs.nprend -application/remote-printing -application/riscos -application/sdp -application/set-payment -application/set-payment-initiation -application/set-registration -application/set-registration-initiation -application/sgml -application/sgml-open-catalog -application/slate -application/smil smi smil -application/vemmi -application/vnd.3M.Post-it-Notes -application/vnd.FloGraphIt -application/vnd.accpac.simply.aso -application/vnd.accpac.simply.imp -application/vnd.acucobol -application/vnd.anser-web-certificate-issue-initiation -application/vnd.anser-web-funds-transfer-initiation -application/vnd.audiograph -application/vnd.businessobjects -application/vnd.bmi -application/vnd.canon-cpdl -application/vnd.canon-lips -application/vnd.claymore -application/vnd.commerce-battelle -application/vnd.commonspace -application/vnd.comsocaller -application/vnd.cosmocaller -application/vnd.cups-postscript -application/vnd.cups-raster -application/vnd.cups-raw -application/vnd.ctc-posml -application/vnd.cybank -application/vnd.dna -application/vnd.dpgraph -application/vnd.dxr -application/vnd.ecdis-update -application/vnd.ecowin.chart -application/vnd.ecowin.filerequest -application/vnd.ecowin.fileupdate -application/vnd.ecowin.series -application/vnd.ecowin.seriesrequest -application/vnd.ecowin.seriesupdate -application/vnd.enliven -application/vnd.epson.msf -application/vnd.epson.quickanime -application/vnd.epson.salt -application/vnd.epson.ssf -application/vnd.ericsson.quickcall -application/vnd.eudora.data -application/vnd.fdf -application/vnd.ffsns -application/vnd.framemaker -application/vnd.fujitsu.oasys -application/vnd.fujitsu.oasys2 -application/vnd.fujitsu.oasys3 -application/vnd.fujitsu.oasysgp -application/vnd.fujitsu.oasysprs -application/vnd.fujixerox.ddd -application/vnd.fujixerox.docuworks -application/vnd.fujixerox.docuworks.binder -application/vnd.fut-misnet -application/vnd.grafeq -application/vnd.groove-account -application/vnd.groove-identity-message -application/vnd.groove-injector -application/vnd.groove-tool-message -application/vnd.groove-tool-template -application/vnd.hp-HPGL -application/vnd.hp-PCL -application/vnd.hp-PCLXL -application/vnd.hp-hpid -application/vnd.hp-hps -application/vnd.hzn-3d-crossword -application/vnd.ibm.MiniPay -application/vnd.ibm.modcap -application/vnd.intercon.formnet -application/vnd.intertrust.digibox -application/vnd.intertrust.nncp -application/vnd.intu.qbo -application/vnd.intu.qfx -application/vnd.is-xpr -application/vnd.japannet-directory-service -application/vnd.japannet-jpnstore-wakeup -application/vnd.japannet-payment-wakeup -application/vnd.japannet-registration -application/vnd.japannet-registration-wakeup -application/vnd.japannet-setstore-wakeup -application/vnd.japannet-verification -application/vnd.japannet-verification-wakeup -application/vnd.koan -application/vnd.lotus-1-2-3 -application/vnd.lotus-approach -application/vnd.lotus-freelance -application/vnd.lotus-notes -application/vnd.lotus-organizer -application/vnd.lotus-screencam -application/vnd.lotus-wordpro -application/vnd.mediastation.cdkey -application/vnd.meridian-slingshot -application/vnd.mif mif -application/vnd.minisoft-hp3000-save -application/vnd.mitsubishi.misty-guard.trustweb -application/vnd.mobius.daf -application/vnd.mobius.dis -application/vnd.mobius.msl -application/vnd.mobius.plc -application/vnd.mobius.txf -application/vnd.motorola.flexsuite -application/vnd.motorola.flexsuite.adsi -application/vnd.motorola.flexsuite.fis -application/vnd.motorola.flexsuite.gotap -application/vnd.motorola.flexsuite.kmr -application/vnd.motorola.flexsuite.ttc -application/vnd.motorola.flexsuite.wem -application/vnd.ms-artgalry -application/vnd.ms-asf -application/vnd.ms-excel xls -application/vnd.ms-powerpoint ppt -application/vnd.ms-project -application/vnd.ms-tnef -application/vnd.ms-works -application/vnd.music-niff -application/vnd.musician -application/vnd.netfpx -application/vnd.noblenet-directory -application/vnd.noblenet-sealer -application/vnd.noblenet-web -application/vnd.novadigm.EDM -application/vnd.novadigm.EDX -application/vnd.novadigm.EXT -application/vnd.osa.netdeploy -application/vnd.pg.format -application/vnd.pg.osasli -application/vnd.powerbuilder6 -application/vnd.powerbuilder6-s -application/vnd.powerbuilder7 -application/vnd.powerbuilder7-s -application/vnd.powerbuilder75 -application/vnd.powerbuilder75-s -application/vnd.previewsystems.box -application/vnd.publishare-delta-tree -application/vnd.rapid -application/vnd.s3sms -application/vnd.seemail -application/vnd.shana.informed.formdata -application/vnd.shana.informed.formtemplate -application/vnd.shana.informed.interchange -application/vnd.shana.informed.package -application/vnd.street-stream -application/vnd.svd -application/vnd.swiftview-ics -application/vnd.triscape.mxs -application/vnd.trueapp -application/vnd.truedoc -application/vnd.ufdl -application/vnd.uplanet.alert -application/vnd.uplanet.alert-wbxml -application/vnd.uplanet.bearer-choi-wbxml -application/vnd.uplanet.bearer-choice -application/vnd.uplanet.cacheop -application/vnd.uplanet.cacheop-wbxml -application/vnd.uplanet.channel -application/vnd.uplanet.channel-wbxml -application/vnd.uplanet.list -application/vnd.uplanet.list-wbxml -application/vnd.uplanet.listcmd -application/vnd.uplanet.listcmd-wbxml -application/vnd.uplanet.signal -application/vnd.vcx -application/vnd.vectorworks -application/vnd.visio -application/vnd.wap.sic -application/vnd.wap.slc -application/vnd.wap.wbxml wbxml -application/vnd.wap.wmlc wmlc -application/vnd.wap.wmlscriptc wmlsc -application/vnd.webturbo -application/vnd.wrq-hp3000-labelled -application/vnd.wt.stf -application/vnd.xara -application/vnd.xfdl -application/vnd.yellowriver-custom-menu -application/wita -application/wordperfect5.1 -application/x-bcpio bcpio -application/x-cdlink vcd -application/x-chess-pgn pgn -application/x-compress -application/x-cpio cpio -application/x-csh csh -application/x-director dcr dir dxr -application/x-dvi dvi -application/x-futuresplash spl -application/x-gtar gtar -application/x-gzip -application/x-hdf hdf -application/x-javascript js -application/x-koan skp skd skt skm -application/x-latex latex -application/x-netcdf nc cdf -application/x-sh sh -application/x-shar shar -application/x-shockwave-flash swf -application/x-stuffit sit -application/x-sv4cpio sv4cpio -application/x-sv4crc sv4crc -application/x-tar tar -application/x-tcl tcl -application/x-tex tex -application/x-texinfo texinfo texi -application/x-troff t tr roff -application/x-troff-man man -application/x-troff-me me -application/x-troff-ms ms -application/x-ustar ustar -application/x-wais-source src -application/x400-bp -application/xml -application/zip zip -audio/32kadpcm -audio/basic au snd -audio/l16 -audio/midi mid midi kar -audio/mpeg mpga mp2 mp3 -audio/vnd.cns.anp1 -audio/vnd.cns.inf1 -audio/vnd.digital-winds -audio/vnd.everad.plj -audio/vnd.lucent.voice -audio/vnd.nortel.vbk -audio/vnd.octel.sbc -audio/vnd.qcelp -audio/vnd.rhetorex.32kadpcm -audio/vnd.vmx.cvsd -audio/x-aiff aif aiff aifc -audio/x-pn-realaudio ram rm -audio/x-pn-realaudio-plugin rpm -audio/x-realaudio ra -audio/x-wav wav -chemical/x-pdb pdb xyz -image/bmp bmp -image/cgm -image/g3fax -image/gif gif -image/ief ief -image/jpeg jpeg jpg jpe -image/naplps -image/png png -image/prs.btif -image/prs.pti -image/tiff tiff tif -image/vnd.cns.inf2 -image/vnd.dwg -image/vnd.dxf -image/vnd.fastbidsheet -image/vnd.fpx -image/vnd.fujixerox.edmics-mmr -image/vnd.fujixerox.edmics-rlc -image/vnd.mix -image/vnd.net-fpx -image/vnd.svf -image/vnd.wap.wbmp wbmp -image/vnd.xiff -image/x-cmu-raster ras -image/x-portable-anymap pnm -image/x-portable-bitmap pbm -image/x-portable-graymap pgm -image/x-portable-pixmap ppm -image/x-rgb rgb -image/x-xbitmap xbm -image/x-xpixmap xpm -image/x-xwindowdump xwd -message/delivery-status -message/disposition-notification -message/external-body -message/http -message/news -message/partial -message/rfc822 -message/s-http -model/iges igs iges -model/mesh msh mesh silo -model/vnd.dwf -model/vnd.flatland.3dml -model/vnd.gdl -model/vnd.gs-gdl -model/vnd.gtw -model/vnd.mts -model/vnd.vtu -model/vrml wrl vrml -multipart/alternative -multipart/appledouble -multipart/byteranges -multipart/digest -multipart/encrypted -multipart/form-data -multipart/header-set -multipart/mixed -multipart/parallel -multipart/related -multipart/report -multipart/signed -multipart/voice-message -text/calendar -text/css css -text/directory -text/enriched -text/html html htm -text/plain asc txt -text/prs.lines.tag -text/rfc822-headers -text/richtext rtx -text/rtf rtf -text/sgml sgml sgm -text/tab-separated-values tsv -text/t140 -text/uri-list -text/vnd.abc -text/vnd.flatland.3dml -text/vnd.fly -text/vnd.fmi.flexstor -text/vnd.in3d.3dml -text/vnd.in3d.spot -text/vnd.latex-z -text/vnd.motorola.reflex -text/vnd.ms-mediapackage -text/vnd.wap.si -text/vnd.wap.sl -text/vnd.wap.wml wml -text/vnd.wap.wmlscript wmls -text/x-setext etx -text/xml xml -video/mpeg mpeg mpg mpe -video/quicktime qt mov -video/vnd.motorola.video -video/vnd.motorola.videop -video/vnd.vivo -video/x-msvideo avi -video/x-sgi-movie movie -x-conference/x-cooltalk ice diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERIMAP.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERIMAP.java deleted file mode 100644 index bc56fa58aa0..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERIMAP.java +++ /dev/null @@ -1,112 +0,0 @@ -/** - * ERIMAP is a utilities class that let you obtain connections and messages from an IMAP server. - * - * @author Pascal Robert - */ - -package er.javamail; - -import javax.mail.AuthenticationFailedException; -import javax.mail.FolderNotFoundException; -import javax.mail.MessagingException; -import javax.mail.internet.MimeMessage; - -import com.sun.mail.imap.IMAPFolder; -import com.sun.mail.imap.IMAPStore; -import com.webobjects.foundation.NSArray; -import com.webobjects.foundation.NSMutableArray; - -public class ERIMAP { - - private IMAPStore imapStore; - - public ERIMAP() { - super(); - } - - /* - * Simply return an IMAP (non-SSL) connection, obtained with a user and password. - * The IMAP server host name is obtained from the er.javamail.imapHost property. - * - * @param The user and password for the user to connect with. - * - */ - public void openConnection(String imapUser, String imapPassword) throws AuthenticationFailedException, MessagingException, IllegalStateException { - imapStore = (IMAPStore)ERJavaMail.sharedInstance().defaultSession().getStore("imap"); - imapStore.connect(imapHost(), imapUser, imapPassword); - } - - /* - * Close the IMAP store and connection. - */ - public void closeConnection() throws MessagingException { - imapStore.close(); - } - - /* - * This method will open a IMAP folder. Check com.sun.mail.imap.IMAPFolder constants for the mode parameter. - * - * @param The folder name to open, and how to open it (read only or read write) - * @return An IMAP folder that you can manipulate. - */ - // mode = Folder.READ_WRITE - public IMAPFolder openFolder(String folderName, int mode) throws MessagingException, FolderNotFoundException { - IMAPFolder folder = (IMAPFolder)imapStore.getFolder(folderName); - folder.open(mode); - return folder; - } - - /* - * Close a IMAP folder and optionally expunge messages with the DELETE flag. - * - * @param An IMAP folder, obtained with openFolder, and a boolean to tell if you want to expunge deleted messages. - */ - public void closeFolder(IMAPFolder folder, boolean expunge) throws MessagingException { - folder.close(expunge); - } - - /* - * Get all messages from an IMAP folder. Simply call getMessages with 1 as the first message index, and folder.getMessageCount as the last message index. - * - * @param An IMAP folder, obtained with openFolder. - * @return A array of ERMessage. - */ - public NSArray getMessages(IMAPFolder folder) throws MessagingException { - return getMessages(folder, 1, folder.getMessageCount()); - } - - /* - * Get specific messages from an IMAP folder, with a starting and an end index. - * - * @param An IMAP folder, obtained with openFolder, the index of the first message to fetch, and the index of the last message. - * @return A array of ERMessage. - */ - public NSArray getMessages(IMAPFolder folder, int firstMsg, int lastMsg) throws MessagingException { - NSMutableArray emails = new NSMutableArray(); - if (folder.isOpen()) { - MimeMessage[] messages = (MimeMessage[])folder.getMessages(firstMsg, lastMsg); - for (int index = 0; index < messages.length; index++) { - MimeMessage mimeMessage = messages[index]; - ERMessage message = new ERMessage(); - message.setMimeMessage(mimeMessage); - emails.add(message); - } - } - return emails; - } - - /* - * Change the er.javamail.imapHost property, useful if you want to change IMAP server from your code. - */ - public void setImapHost(String _imapHost) { - System.setProperty("er.javamail.imapHost", _imapHost); - } - - /* - * Fetch the IMAP server hostname from the er.javamail.imapHost property. - */ - public String imapHost() { - return System.getProperty("er.javamail.imapHost"); - } - -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERJavaMail.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERJavaMail.java deleted file mode 100644 index 37944680c75..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERJavaMail.java +++ /dev/null @@ -1,870 +0,0 @@ -package er.javamail; - -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.ConcurrentHashMap; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; - -import com.webobjects.eocontrol.EOEnterpriseObject; -import com.webobjects.eocontrol.EOOrQualifier; -import com.webobjects.eocontrol.EOQualifier; -import com.webobjects.foundation.NSArray; -import com.webobjects.foundation.NSMutableArray; - -import er.extensions.ERXExtensions; -import er.extensions.ERXFrameworkPrincipal; -import er.extensions.foundation.ERXProperties; -import er.extensions.validation.ERXValidationFactory; - -/** - * ERJavaMail is the principal class for the ERJavaMail framework. - * - * @property er.javamail.centralize - * @property er.javamail.adminEmail - * @property er.javamail.debugEnabled - * @property er.javamail.senderQueue.size - * @property er.javamail.milliSecondsWaitIfSenderOverflowed - * @property er.javamail.XMailerHeader - * @property er.javamail.smtpProtocol - * @property er.javamail.smtpHost - * @property mail.[smtpProtocol].host - * @property WOSMTPHost - * @property er.javamail.smtpPort - * @property mail.[smtpProtocol].port - * @property er.javamail.smtpAuth - * @property mail.[smtpProtocol].auth - * @property er.javamail.smtpUser - * @property mail.[smtpProtocol].user - * @property er.javamail.smtpPassword - * @property mail.[smtpProtocol].password - * @property mail.smtps.socketFactory.fallback - * @property er.javamail.emailPattern - * @property er.javamail.WhiteListEmailAddressPatterns - * @property er.javamail.BlackListEmailAddressPatterns - * - * @author Camille Troillard - * @author Max Muller - */ -public class ERJavaMail extends ERXFrameworkPrincipal { - public final static Class REQUIRES[] = new Class[] { ERXExtensions.class }; - - static { - setUpFrameworkPrincipalClass(ERJavaMail.class); - } - - /** - * ERJavaMail class singleton. - * - * シングルトン・クラス - */ - protected static ERJavaMail sharedInstance; - - /** - * Accessor to the ERJavaMail singleton. - * - * @return the one ERJavaMail instance - * - * ERJavaMail シングルトン・アクセス・メソッド - * - * @return ERJavaMail インスタンス - */ - public static synchronized ERJavaMail sharedInstance() { - if (sharedInstance == null) { - sharedInstance = ERXFrameworkPrincipal.sharedInstance(ERJavaMail.class); - } - return sharedInstance; - } - - /** - * EMAIL_VALIDATION_PATTERN is a regexp pattern that is used to validate emails. - * - * - * EMAIL_VALIDATION_PATTERN はメールアドレスの検証のための Regex パタン - */ - // RFC 2822 token definitions for valid email - only used together to form a java Pattern object: - private static final String sp = "!#$%&'*+\\-/=?^_`{|}~"; - private static final String atext = "[a-zA-Z0-9" + sp + "]"; - private static final String atom = atext + "+"; // one or more atext chars - private static final String dotAtom = "\\." + atom; - private static final String localPart = atom + "(" + dotAtom + ")*"; // one atom followed by 0 or more dotAtoms. - // RFC 1035 tokens for domain names: - private static final String letter = "[a-zA-Z]"; - private static final String letDig = "[a-zA-Z0-9]"; - private static final String letDigHyp = "[a-zA-Z0-9\\-]"; - private static final String rfcLabel = letDig + "(" + letDigHyp + "{0,61}" + letDig + "){0,1}"; - private static final String domain = rfcLabel + "((\\." + rfcLabel + ")*\\." + letter + "{2,6}){0,1}"; - // Combined together, these form the allowed email regexp allowed by RFC 2822: - private static final String EMAIL_VALIDATION_PATTERN = "^" + localPart + "@" + domain + "$"; - - /** - * The compiled form of the EMAIL_VALIDATION_PATTERN pattern. - */ - protected Pattern _pattern = null; - - private Delegate _delegate; - - public void setDelegate(Delegate delegate) { - _delegate = delegate; - } - - /** - * Specialized implementation of the method from ERXPrincipalClass. - */ - @Override - public void finishInitialization() { - initializeFrameworkFromSystemProperties(); - log.debug("ERJavaMail loaded"); - } - - /** - * This method is used to initialize ERJavaMail from System properties. Later, we will implement a - * way to initialize those properties everytime the propertis are changed. The observer will call this method - * whenever appropriate. - * - * このメソッドは ERJavaMail をシステム・プロパティより初期化するためにあります。 後でプロパティが変更される度にこのメソッドが実行される処理を追加実装します。 - */ - public void initializeFrameworkFromSystemProperties() { - // Centralize mails ? - boolean centralize = ERXProperties.booleanForKey("er.javamail.centralize"); - setCentralize(centralize); - log.debug("er.javamail.centralize: " + centralize); - - String adminEmail = System.getProperty("er.javamail.adminEmail"); - if (isValidEmail(adminEmail)) { - setAdminEmail(adminEmail); - log.debug("er.javamail.adminEmail: " + _adminEmail); - } - else if (centralize) { - throw new IllegalArgumentException("When 'er.javamail.centralize' is true (default)," + " all outgoing mails will get sent to 'er.javamail.adminEmail'" + " instead of the normal TO addresses, but you did not provide a valid email for that property."); - } - - // JavaMail Debug Enabled ? - boolean debug = ERXProperties.booleanForKey("er.javamail.debugEnabled"); - setDebugEnabled(debug); - log.debug("er.javamail.debugEnabled: " + debug); - - // Number of messages that the sender queue can hold at a time - int queueSize = ERXProperties.intForKey("er.javamail.senderQueue.size"); - if (queueSize >= 1) - setSenderQueueSize(queueSize); - log.debug("er.javamail.senderQueue.size: " + queueSize); - - // Time to wait when sender if overflowed - int milliswait = ERXProperties.intForKey("er.javamail.milliSecondsWaitIfSenderOverflowed"); - if (milliswait > 1000) - setMilliSecondsWaitIfSenderOverflowed(milliswait); - log.debug("er.javamail.milliSecondsWaitIfSenderOverflowed: " + milliswait); - - // Smtp host - setupSmtpHostSafely(); - - setDefaultSession(newSession()); - - if (defaultSession() == null) - log.warn("Unable to create default mail session!"); - - // Default X-Mailer header - setDefaultXMailerHeader(System.getProperty("er.javamail.XMailerHeader")); - log.debug("er.javamail.XMailHeader: " + defaultXMailerHeader()); - } - - /** - * Helper method to init the smtpHost property. This method first check is - * er.javamail.smtpHost is set. If it is not set, then it looks for mail.smtp.host - * (standard JavaMail property) and finally the WOSMTPHost property. When a correct property is found, - * then it sets both properties to the found value. If no properties are found, a RuntimeException is thrown. - * - * @throws RuntimeException - * if neither one of er.javamail.smtpHost, mail.smtp.host or - * WOSMTPHost is set. - * - * smtpHost プロパティを初期化するヘルプ・メソッドです。 最初には er.javamail.smtpHost - * がセットされているかどうかをチェックします。 セットされていなければ、mail.smtp.host (標準 JavaMail プロパティ) をチェックし、最終的には - * WOSMTPHost プロパティ。 正しいプロパティが見つかると結果値を両方のプロパティにセットします。見つからない場合には RuntimeException が発生します。 - * - * @throws RuntimeException - * - er.javamail.smtpHost, mail.smtp.host 又は WOSMTPHost - * がセットされていなければ - */ - protected void setupSmtpHostSafely() { - setupSmtpProperties(System.getProperties(), null); - } - - protected void setupSmtpProperties(Properties properties, String contextString) { - String contextSuffix = contextString == null ? "" : ("." + contextString); - - // Smtp host - String smtpProtocol = smtpProtocolForContext(contextString); - - String smtpHost = ERXProperties.stringForKeyWithDefault("er.javamail.smtpHost" + contextSuffix, ERXProperties.stringForKey("er.javamail.smtpHost")); - if ((smtpHost == null) || (smtpHost.length() == 0)) { - // Try to fail back to default java config - smtpHost = ERXProperties.stringForKey("mail." + smtpProtocol + ".host"); - - if ((smtpHost == null) || (smtpHost.length() == 0)) { - // use the standard WO host - smtpHost = ERXProperties.stringForKey("WOSMTPHost"); - if ((smtpHost == null) || (smtpHost.length() == 0)) { - throw new RuntimeException("ERJavaMail: You must specify a SMTP host for outgoing mail with the property 'er.javamail.smtpHost'"); - } - // ... and then maybe actually do what the docs say this method is supposed to do - properties.setProperty("mail." + smtpProtocol + ".host", smtpHost); - properties.setProperty("er.javamail.smtpHost", smtpHost); - } - else { - properties.setProperty("er.javamail.smtpHost", smtpHost); - } - } - else { - properties.setProperty("mail." + smtpProtocol + ".host", smtpHost); - } - log.debug("er.javamail.smtpHost: " + smtpHost); - - String port = ERXProperties.stringForKeyWithDefault("er.javamail.smtpPort" + contextSuffix, ERXProperties.stringForKey("er.javamail.smtpPort")); - if (port != null && port.length() > 0) { - properties.setProperty("mail." + smtpProtocol + ".port", port); - log.debug("ERJavaMail will use smtp port: " + port); - } - - boolean smtpAuth = ERXProperties.booleanForKeyWithDefault("er.javamail.smtpAuth" + contextSuffix, ERXProperties.booleanForKey("er.javamail.smtpAuth")); - log.debug("ERJavaMail will use authenticated SMTP connections."); - if (smtpAuth) { - properties.setProperty("mail." + smtpProtocol + ".auth", String.valueOf(smtpAuth)); - String user = ERXProperties.stringForKeyWithDefault("er.javamail.smtpUser" + contextSuffix, ERXProperties.stringForKey("er.javamail.smtpUser")); - if (user == null || user.length() == 0) { - throw new RuntimeException("You specified er.javamail.smtpAuth=true, but you didn't specify an er.javamail.smtpUser to use as the login name."); - } - properties.setProperty("mail." + smtpProtocol + ".user", user); - String password = ERXProperties.stringForKeyWithDefault("er.javamail.smtpPassword" + contextSuffix, ERXProperties.stringForKey("er.javamail.smtpPassword")); - if (password == null || password.length() == 0) { - log.warn("You specified er.javamail.smtpAuth=true, but you didn't set er.javamail.smtpPassword for the " + user + " mail user."); - } - if (password != null) { - properties.setProperty("mail." + smtpProtocol + ".password", password); - } - } - if ("smtps".equals(smtpProtocol)) { - properties.setProperty("mail.smtps.socketFactory.fallback", "false"); - } - } - - /** - * This is the default JavaMail Session. It is shared among all deliverers for immediate - * deliveries. Deferred deliverers, use their own JavaMail session. - * - * JavaMail のデフォルト・セッションです。 即時配信処理より共有されています。 延期配信は独自の JavaMail セッションを使用しています。 - */ - protected javax.mail.Session _defaultSession; - private final Map _sessions = new ConcurrentHashMap(); - - /** - * Sets the default JavaMail session to a particular value. This value is set by default at - * initialization of the framework but you can specify a custom one by using this method. Note that a new deliverer - * need to be instanciated for changes to be taken in account. - * - * @param session - * the default javax.mail.Session - * - * JavaMail のデフォルト・セッションをセットします。 フレームワークの初期化時に設定されのですが、独自で設定する時には ここを実行するといいのです。 - * - * @param session - * - デフォルト javax.mail.Session - */ - public void setDefaultSession(javax.mail.Session session) { - session.setDebug(debugEnabled()); - _defaultSession = session; - } - - /** - * This is the deafult JavaMail Session accessor. It is shared among all deliverers for immediate - * deliveries. Deferred deliverers, use their own JavaMail session. - * - * @return the default javax.mail.Session instance - * - * JavaMail のデフォルト・セッション・アクセス方法です。 即時配信処理のために共有されています。 延期配信は独自の JavaMail セッションを使用しています。 - * - * @return デフォルト javax.mail.Session インスタンス - */ - public javax.mail.Session defaultSession() { - return _defaultSession; - } - - /** - * Returns a newly allocated Session object from the given Properties - * - * @param props - * a Properties value - * @return a javax.mail.Session value initialized from the given properties - * - * 指定プロパティを使った新規セッションを戻します。 - * - * @param props - * - Properties 値 - * - * @return 指定プロパティで初期化されている javax.mail.Session - */ - public javax.mail.Session newSession(Properties props) { - return newSessionForContext(props, null); - } - - /** - * Returns a newly allocated Session object from the System Properties - * - * @return a javax.mail.Session value - * - * システム・プロパティを使った新規セッションを戻します。 - * - * @return javax.mail.Session - */ - public javax.mail.Session newSession() { - return newSession(System.getProperties()); - } - - /** - * Returns a newly allocated Session object for the given message. - * - * @param message - * the message - * @return a new javax.mail.Session value - */ - public javax.mail.Session newSessionForMessage(ERMessage message) { - return newSessionForContext(message.contextString()); - } - - /** - * Returns the Session object that is appropriate for the given message. - * - * @return a javax.mail.Session value - */ - public javax.mail.Session sessionForMessage(ERMessage message) { - return sessionForContext(message.contextString()); - } - - /** - * Returns a new Session object that is appropriate for the given context. - * - * @param contextString - * the message context - * @return a new javax.mail.Session value - */ - protected javax.mail.Session newSessionForContext(String contextString) { - javax.mail.Session session; - if (contextString == null || contextString.length() == 0) { - session = newSessionForContext(System.getProperties(), contextString); - } - else { - Properties sessionProperties = new Properties(); - sessionProperties.putAll(System.getProperties()); - setupSmtpProperties(sessionProperties, contextString); - session = newSessionForContext(sessionProperties, contextString); - } - return session; - } - - /** - * Returns a newly allocated Session object from the given Properties - * - * @param properties - * a Properties value - * @return a javax.mail.Session value initialized from the given properties - */ - public javax.mail.Session newSessionForContext(Properties properties, String contextString) { - if (_delegate != null) { - _delegate.willCreateSessionWithPropertiesForContext(properties, contextString); - } - javax.mail.Session session = javax.mail.Session.getInstance(properties); - if (_delegate != null) { - _delegate.didCreateSession(session); - } - session.setDebug(debugEnabled()); - return session; - } - - /** - * Returns the Session object that is appropriate for the given context. - * - * @param contextString - * the message context - * @return a javax.mail.Session value - */ - protected javax.mail.Session sessionForContext(String contextString) { - javax.mail.Session session; - if (contextString == null || contextString.length() == 0) { - session = defaultSession(); - } - else { - session = _sessions.get(contextString); - if (session == null) { - session = newSessionForContext(contextString); - _sessions.put(contextString, session); - } - } - return session; - } - - /** - * email address used when centralizeMails == true
- * Needed when debugging application so that mails are always sent to only one destination. - */ - protected String _adminEmail; - - /** - * admin email accessor. The admin email is the email address where centralized mail go to. - * - * @return a String value - * - * centralizeMails == true の場合で使用されるメール・アドレス
- * デバッグ中にすべてのメールが一つのターゲットに送信されます。 - * - * @return メール・アドレス
- */ - public String adminEmail() { - return _adminEmail; - } - - /** - * Sets the admin email to another value. This value is set at initialization from the - * er.javamail.adminEmail Property. - * - * @param adminEmail - * a String value - * - * この値は初期化中で er.javamail.adminEmail プロパティより設定されますが、 このコマンドでオーバライドが可能です。 - * - * @param adminEmail - * - メール・アドレス - */ - public void setAdminEmail(String adminEmail) { - if (!(isValidEmail(adminEmail) || (adminEmail != null && adminEmail.trim().length() > 0))) { - throw new IllegalArgumentException("You specified an invalid admin email address '" + adminEmail + "'."); - } - _adminEmail = adminEmail; - } - - /** This property specify wether JavaMail is debug enabled or not. */ - protected boolean _debugEnabled = true; - - /** - * Returns true if JavaMail is debug enabled. - * - * @return a boolean value - * - * JavaMail がデバッグ中の場合には true が戻ります。 - * - * @return boolean - */ - public boolean debugEnabled() { - return _debugEnabled; - } - - /** - * Sets the debug mode of JavaMail. - * - * @param debug - * a boolean value sets JavaMail in debug mode - * - * JavaMail のデバッグ・モードをセットします。 - * - * @param debug - * - boolean でデバッグ・モードを On / Off できます - */ - public void setDebugEnabled(boolean debug) { - _debugEnabled = debug; - } - - /** This property sets the default header for the X-Mailer property */ - protected String _defaultXMailerHeader = null; - - /** - * Gets the default X-Mailer header to use for sending mails. Pulls the value out of the property: - * er.javamail.XMailerHeader - * - * @return default X-Mailer header - * - * 送信時の XMailer ヘッダーのデフォルト値を取得します。 プロパティの er.javamail.XMailerHeader を参照! - * - * @return デフォルト X-Mailer ヘッダー - */ - public String defaultXMailerHeader() { - return _defaultXMailerHeader; - } - - /** - * Sets the default value of the XMailer header used when sending mails. - * - * @param header - * a String value - * - * 送信時の XMailer ヘッダーのデフォルト値をセットします。 - * - * @param header - * - String - */ - public void setDefaultXMailerHeader(String header) { - _defaultXMailerHeader = header; - } - - /** Used to send mail to adminEmail only. Useful for debugging issues */ - protected boolean _centralize = true; - - /** - * Centralize is used to send all the outbound email to a single address which is useful when - * debugging. - * - * @return a boolean value - * - * すべてのメールを er.javamail.adminEmail ユーザに送信します。(デバッグ中に便利) - * - * @return boolean - */ - public boolean centralize() { - return _centralize; - } - - /** - * Sets the value of the er.javamail.centralize Property. - * - * @param centralize - * if the boolean value is true, then all the outbound mails will be sent to adminEmail - * email address. - * - * er.javamail.centralize プロパティの値をセットします。 - * - * @param centralize - * - true の場合にはすべてのメールが adminEmail へ送信されます。 - */ - public void setCentralize(boolean centralize) { - _centralize = centralize; - } - - /** - * Returns the SMTP protocol to use for connections. - * - * 接続の為の SMTP プロトコールを設定します。 (smtp or smtps) - * - * @param contextString - * - SMTP プロトコール名 - */ - public String smtpProtocolForContext(String contextString) { - String contextSuffix = (contextString == null) ? "" : ("." + contextString); - return ERXProperties.stringForKeyWithDefault("er.javamail.smtpProtocol" + contextSuffix, ERXProperties.stringForKeyWithDefault("er.javamail.smtpProtocol", ERXProperties.stringForKeyWithDefault("mail.smtp.protocol", "smtp"))); - } - - /** - * Number of messages that the sender queue can hold at a time; default to 50 messages and can be configured by - * er.javamail.senderQueue.size system property. - */ - protected int _senderQueueSize = 50; - - public int senderQueueSize() { - return _senderQueueSize; - } - - /** - * 送信キューが一回で保持できるメッセージ数です。 デフォルトでは 50 メッセージで、システム・プロパティの er.javamail.senderQueue.size - * で変更可能です。 - */ - public void setSenderQueueSize(int value) { - _senderQueueSize = value; - } - - /** - * Wait n milliseconds (by default this value is 6000) if the mail sender is overflowed - * - * メール・キューがオーバフローされている時に待つ時間。 (デフォルトでは 6000) - */ - protected int _milliSecondsWaitIfSenderOverflowed = 6000; - - /** - * This method return the time spent waiting if the mail queue if overflowed. During that time, - * mails are sent and the queue lowers. When the duration is spent, and the queue is under the overflow limit, the - * mails are being sent again. - * - * @return an int value - * - * メール・キューがオーバフローされている時に待つ時間を設定します。この時間内ではメールが送信され、キューが減ります。 - * 期間が過ぎるとキューがオーバフロー制限より以下であれば、メールが再度に送信されます。 - * - * @return int - */ - public int milliSecondsWaitIfSenderOverflowed() { - return _milliSecondsWaitIfSenderOverflowed; - } - - /** - * Sets the value of the er.javamail.milliSecondsWaitIfSenderOverflowed Property. - * - * @param value - * an int value in milli-seconds. - * - * er.javamail.milliSecondsWaitIfSenderOverflowed プロパティをセットします。 - * - * @param value - * - int ミリ秒 - */ - public void setMilliSecondsWaitIfSenderOverflowed(int value) { - _milliSecondsWaitIfSenderOverflowed = value; - } - - /** - * Validates an enterprise object's email attribute (accessed via key). - * - * @param object - * the object to be validated - * @param key - * the attribute's name - * @param email - * the email value - * @return the email if the validation didn't failed - * - * エンタプライス・オブジェクトのメール・アトリビュートを検証します。(キーよりのアクセス) - * - * @param object - * - 検証するオブジェクト - * @param key - * - アトリビュート名 - * @param email - * - メール値 - * - * @return 検証が失敗しない場合のメールアドレス - */ - public String validateEmail(EOEnterpriseObject object, String key, String email) { - if (email != null) { - if (!isValidEmail(email)) - throw ERXValidationFactory.defaultFactory().createException(object, key, email, "malformedEmail"); - } - - return email; - } - - /** - * Predicate used to validate email well-formness. - * - * @return true if the email is valid - * @param email - * the email String value to validate - * @return a boolean value - * - * メールが正しいかどうかを検証します。 - * - * @param email - * - 検証するメール値 - * - * @return メールが有効であれば true が戻ります。 - */ - public synchronized boolean isValidEmail(String email) { - if (_pattern == null) { - String patternString = ERXProperties.stringForKey("er.javamail.emailPattern"); - if (patternString == null || patternString.trim().length() == 0) { - patternString = EMAIL_VALIDATION_PATTERN; - } - - try { - _pattern = Pattern.compile(patternString); - } - catch (PatternSyntaxException e) { - throw new RuntimeException("The compilation of the email pattern '" + patternString + "' failed.", e); - } - } - if (email != null) { - return _pattern.matcher(email).matches(); - } - return false; - } - - // =========================================================================== - // Black and White list email address filtering support - // メール・フィルター: ホワイト&ブラック・リスト - // --------------------------------------------------------------------------- - - /** - * holds the array of white list email addresses - * - * ホワイト・リスト・メールアドレス配列を保持 - */ - protected NSArray whiteListEmailAddressPatterns; - - /** - * holds the array of black list email addresses - * - * ブラック・リスト・メールアドレス配列を保持 - */ - protected NSArray blakListEmailAddressPatterns; - - /** - * holds the white list qualifier - * - * ホワイト・リスト qualifier を保持 - */ - protected EOOrQualifier whiteListQualifier; - - /** - * holds the black list qualifier - * - * ブラック・リスト qualifier を保持 - */ - protected EOOrQualifier blackListQualifier; - - /** - * Determines if a white list has been specified - * - * @return if the white list has any elements in it - * - * ホワイト・リストがあるかどうかを戻します。 - * - * @return ホワイト・リストがある場合には true が戻ります。 - */ - public boolean hasWhiteList() { - return whiteListEmailAddressPatterns().count() > 0; - } - - /** - * Determines if a black list has been specified - * - * @return if the black list has any elements in it - * - * ブラック・リストがあるかどうかを戻します。 - * - * @return ブラック・リストがある場合には true が戻ります。 - */ - public boolean hasBlackList() { - return blackListEmailAddressPatterns().count() > 0; - } - - /** - * Gets the array of white list email address patterns. - * - * @return array of white list email address patterns - * - * ホワイト・リスト・メールアドレス配列パターンを戻します。 - * - * @return ホワイト・リスト・メールアドレス配列パターン - */ - @SuppressWarnings("unchecked") - public NSArray whiteListEmailAddressPatterns() { - if (whiteListEmailAddressPatterns == null) { - whiteListEmailAddressPatterns = ERXProperties.arrayForKeyWithDefault("er.javamail.WhiteListEmailAddressPatterns", NSArray.EmptyArray); - } - return whiteListEmailAddressPatterns; - } - - /** - * Gets the array of black list email address patterns. - * - * @return array of black list email address patterns - * - * ブラック・リスト・メールアドレス配列パターンを戻します。 - * - * @return ブラック・リスト・メールアドレス配列パターン - */ - @SuppressWarnings("unchecked") - public NSArray blackListEmailAddressPatterns() { - if (blakListEmailAddressPatterns == null) { - blakListEmailAddressPatterns = ERXProperties.arrayForKeyWithDefault("er.javamail.BlackListEmailAddressPatterns", NSArray.EmptyArray); - } - return blakListEmailAddressPatterns; - } - - /** - * Whilte list Or qualifier to match any of the patterns in the white list. - * - * @return Or qualifier for the white list ホワイト・リスト内でマッチするパタンのホワイト・リスト Or qualifier - * - * @return ホワイト・リスト Or qualifier - */ - public EOOrQualifier whiteListQualifier() { - if (whiteListQualifier == null) { - whiteListQualifier = qualifierArrayForEmailPatterns(whiteListEmailAddressPatterns()); - } - return whiteListQualifier; - } - - /** - * Gets the Or qualifier to match any of the patterns in the black list. - * - * @return or qualifier - * - * ブラック・リスト内でマッチするパタンのブラック・リスト Or qualifier - * - * @return ブラック・リスト Or qualifier - */ - public EOOrQualifier blackListQualifier() { - if (blackListQualifier == null) { - blackListQualifier = qualifierArrayForEmailPatterns(blackListEmailAddressPatterns()); - } - return blackListQualifier; - } - - /** - * Constructs an Or qualifier for filtering an array of strings that might have the * wildcard - * character. Will be nice when we have regex in Java 1.4. - * - * @param emailPatterns - * array of email patterns - * @return or qualifier to match any of the given patterns - * - * ワイルドカード文字 * を持つ配列をフィルターする Or qualifier を作成します。 - * - * @param emailPatterns - * - メール・パタンの配列 - * - * @return 指定パタンのマッチに使用する or qualifier - */ - protected EOOrQualifier qualifierArrayForEmailPatterns(NSArray emailPatterns) { - NSMutableArray patternQualifiers = new NSMutableArray(); - for (String pattern : emailPatterns) { - patternQualifiers.addObject(EOQualifier.qualifierWithQualifierFormat("toString caseInsensitiveLike '" + pattern + "'", null)); - } - return new EOOrQualifier(patternQualifiers); - } - - /** - * Filters an array of email addresses by the black and white lists. - * - * @param emailAddresses - * array of email addresses to be filtered - * @return array of filtered email addresses - * - * メールアドレス配列をホワイト&ブラック・リストでフィルターします。 - * - * @param emailAddresses - * - フィルターするメール・アドレス配列 - * - * @return フィルター済みのメールアドレス配列 - */ - public NSArray filterEmailAddresses(NSArray emailAddresses) { - NSMutableArray filteredAddresses = null; - if ((emailAddresses != null) && (emailAddresses.count() > 0) && (hasWhiteList() || hasBlackList())) { - filteredAddresses = new NSMutableArray(emailAddresses); - - if (log.isDebugEnabled()) { - log.debug("Filtering email addresses: " + filteredAddresses); - } - - if (hasWhiteList()) { - EOQualifier.filterArrayWithQualifier(filteredAddresses, whiteListQualifier()); - if (log.isDebugEnabled()) { - log.debug("White list qualifier: " + whiteListQualifier() + " after filtering: " + filteredAddresses); - } - } - - if (hasBlackList()) { - NSArray filteredOutAddresses = EOQualifier.filteredArrayWithQualifier(filteredAddresses, blackListQualifier()); - if (filteredOutAddresses.count() > 0) - filteredAddresses.removeObjectsInArray(filteredOutAddresses); - if (log.isDebugEnabled()) { - log.debug("Black list qualifier: " + blackListQualifier() + " filtering: " + filteredAddresses); - } - } - } - - return (filteredAddresses != null) ? filteredAddresses.immutableClone() : emailAddresses; - } - - public static interface Delegate { - public void willCreateSessionWithPropertiesForContext(Properties properties, String contextString); - - public void didCreateSession(javax.mail.Session session); - } -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailAttachment.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailAttachment.java deleted file mode 100644 index 311af8448a3..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailAttachment.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - ERMailAttachement.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import javax.mail.BodyPart; -import javax.mail.MessagingException; - -public abstract class ERMailAttachment { - protected Object _content; - - public ERMailAttachment(Object content) { - super(); - _content = content; - } - - protected Object content() { - return _content; - } - - protected void setContent(Object content) { - _content = content; - } - - protected abstract BodyPart getBodyPart() throws MessagingException; -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDataAttachment.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDataAttachment.java deleted file mode 100644 index 13def1e8d01..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDataAttachment.java +++ /dev/null @@ -1,133 +0,0 @@ -package er.javamail; - -import javax.activation.DataHandler; -import javax.activation.DataSource; -import javax.activation.FileTypeMap; -import javax.mail.BodyPart; -import javax.mail.MessagingException; -import javax.mail.internet.MimeBodyPart; -import javax.mail.util.ByteArrayDataSource; - -import com.webobjects.foundation.NSData; - -/** - * - * Attaches a byte array or NSData to a mail. The mime type is pulled from the file name, so be sure to provide a - * reasonable one. - * - * - * - * byte 配列、又は NSData をメールに添付します。 - * mime タイプはファイル名より取得され、正しいファイル名を渡す必要がある。 - * - * - * @author ak - */ -public class ERMailDataAttachment extends ERMailAttachment { - - protected String _fileName; - protected String _contentID; - protected String _mimeType; - protected DataHandler _dataHandler; - - protected ERMailDataAttachment(Object content) { - super(content); - } - - public ERMailDataAttachment(String fileName, String id, NSData content) { - this(fileName, id, content._bytesNoCopy()); - } - - public ERMailDataAttachment(String fileName, String id, byte content[]) { - super(content); - _mimeType = FileTypeMap.getDefaultFileTypeMap().getContentType(fileName); - _fileName = fileName; - _contentID = id; - } - - public ERMailDataAttachment(String fileName, String id, DataHandler aHandler) { - super(null); - _fileName = fileName; - _contentID = id; - _dataHandler = aHandler; - _mimeType = FileTypeMap.getDefaultFileTypeMap().getContentType(fileName); - } - - /** - * - * ファイル名を取得します。 - * 設定されていなければ、"attachement.txt" が戻ります。 - * - * @return ファイル名 - * - */ - public String fileName() { - if (_fileName == null) - _fileName = "attachement.txt"; - return _fileName; - } - - /** - * - * DataHandler を取得します。 - * - * @return DataHandler - * - */ - public DataHandler getDataHandler() { - return _dataHandler; - } - - /** - * - * ファイル名をセットします。 - * - * @param name - ファイル名 - * - */ - public void setFileName(String name) { - _fileName = name; - } - - /** - * - * コンテント ID を取得します。 - * - * @return コンテント ID - * - */ - public String contentID() { - return _contentID; - } - - /** - * - * コンテント ID をセットします。 - * - * @param id - コンテント ID - * - */ - public void setContentID(String id) { - _contentID = id; - } - - @Override - protected BodyPart getBodyPart() throws MessagingException { - MimeBodyPart bp = new MimeBodyPart(); - if (getDataHandler() == null) { - DataSource ds = new ByteArrayDataSource((byte[]) content(), _mimeType); - bp.setDataHandler(new DataHandler(ds)); - } else { - bp.setDataHandler(getDataHandler()); - if (_mimeType != null) { - bp.setHeader("Content-type", _mimeType); - } - } - - if (contentID() != null) { - bp.setHeader("Content-ID", contentID()); - } - bp.setFileName(fileName()); - return bp; - } -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDelivery.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDelivery.java deleted file mode 100644 index 29770fb93fd..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDelivery.java +++ /dev/null @@ -1,771 +0,0 @@ -/* - ERMailDelivery.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import java.util.Date; - -import javax.activation.DataHandler; -import javax.mail.Address; -import javax.mail.BodyPart; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.Part; -import javax.mail.internet.AddressException; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeBodyPart; -import javax.mail.internet.MimeMessage; -import javax.mail.internet.MimeMessage.RecipientType; -import javax.mail.internet.MimeMultipart; - -import org.apache.commons.lang.CharEncoding; -import org.apache.log4j.Logger; - -import com.webobjects.foundation.NSArray; -import com.webobjects.foundation.NSDictionary; -import com.webobjects.foundation.NSForwardException; -import com.webobjects.foundation.NSMutableArray; -import com.webobjects.foundation.NSMutableDictionary; - -/** - * - * This is the main class for sending mail with the JavaMail API. You should create - * instances of its subclasses that match with specific use cases. - * - *

Here is an example of its usage: - * - * - * - * JavaMail API でメールを送信するメインクラスです。このクラスは抽選クラスなので、のインスタンスを作成しません。 - * 替わりに特集なサブクラスを作る場合にインスタンス化する必要はあるでしょう! - * - *

使用方法: - * - -

-    ERMailDeliveryHTML mail = new ERMailDeliveryHTML ();
-    mail.setWOComponentContent (mailPage);
- 
-    try {
-        mail.newMail ();
-        mail.setFromAddress(emailFrom);
-        mail.setReplyToAddress(emailReplyTo);
-        mail.setSubject(emailSubject);
-        mail.setToAddresses(new NSArray (toEmailAddresses));
-
-        // Send the mail
-        mail.sendMail ();
-    } catch (Exception e) {
-        // do something ...
-    }

- * - * @property er.javamail.defaultEncoding - * - * @author Camille Troillard - * @author ak fixes - */ -public abstract class ERMailDelivery { - private static final Logger log = Logger.getLogger(ERMailDelivery.class); - - /** JavaMail session */ - private javax.mail.Session _session; - - /** - * - * Content of sent mail. In one instance of ERMailDelivery, when creating multiple mails, you must be sure to call - * newMail () method before send a new mail in order to have a cleared fresh mail - * - * - * - * メールのコンテントです。 - * ERMailDelivery のインスタンスで複数メールを送信する時には newMail() コマンドで初期化を行ってください。 - * - */ - protected MimeMessage _mimeMessage; - - /** - * - * NSArray of ERMailAttachment that must be binded to the message as ATTACHEMENT. - * - * - * - * ERMailAttachment の NSArray でメッセージの ATTACHEMENT としてバインディングされる - * - */ - protected NSMutableArray _attachments; - - /** - * - * NSArray of ERMailAttachment that must be binded to the message as INLINE. - * - * - * - * ERMailAttachment の NSArray でメッセージの INLINE としてバインディングされる - * - */ - protected NSMutableArray _inlineAttachments; - - private ERMessage.Delegate _delegate; - private NSDictionary _userInfo; - private String _contextString; - - public static final String DefaultCharset = System.getProperty("er.javamail.defaultEncoding", CharEncoding.UTF_8); - public String _charset = DefaultCharset; - - /** Designated constructor */ - public ERMailDelivery(javax.mail.Session session) { - super(); - _session = session; - _mimeMessage = new MimeMessage(session); - } - - /** Default constructor */ - public ERMailDelivery() { - this(ERJavaMail.sharedInstance().defaultSession()); - } - - /** - * - * Sets the given delegate to listen to any messages that are created from this ERMailDelivery. This will - * automatically call ERMessage.setDelegate(delegate) for any ERMessage that is generated. - * - * @param delegate - * the delegate to use for notifications - * - * - * - * この ERMailDelivery で作成されるすべてのメッセージをリスンするデリゲートを指定します。 - * 作成される全メッセージの ERMessage.setDelegate(delegate) が確実に呼ばれます。 - * - * @param delegate - 通知のためのデリゲート - * - */ - public void setDelegate(ERMessage.Delegate delegate) { - _delegate = delegate; - } - - /** - * - * Sets the userInfo dictionary for this ERMailDelivery. This userInfo is passed through to any ERMessage that is - * created by this ERMailDelivery, which can be used by delegates to get additional information about the message. - * - * @param userInfo - * the userInfo dictionary - * - * - * - * ERMailDelivery のユーザ情報ディクショナリーをセットします。 - * このユーザ情報は ERMailDelivery で作成される全メッセージに行き渡ります。 - * デリゲートと合わせてメッセージの追加情報で使用できます。 - * - * @param userInfo - ユーザ情報ディクショナリー - * - */ - public void setUserInfo(NSDictionary userInfo) { - _userInfo = userInfo; - } - - /** - * - * Returns the userInfo dictionary for this ERMailDelivery. - * - * @return the userInfo dictionary - * - * - * - * ERMailDelivery のユーザ情報ディクショナリーを戻します。 - * - * @return ユーザ情報ディクショナリー - * - */ - public NSDictionary userInfo() { - return _userInfo; - } - - public void setContextString(String contextString) { - _contextString = contextString; - } - - public String contextString() { - return _contextString; - } - - public String charset() { - return _charset; - } - - public void setCharset(String charset) { - _charset = charset; - } - - protected javax.mail.Session session() { - return _session; - } - - protected void setSession(javax.mail.Session aSession) { - _session = aSession; - } - - /** - * - * Creates a new mail instance within ERMailDelivery - * - * - * - * ERMailDelivery インスタンス内で新しいメールを作成します。 - * - */ - public void newMail() { - _attachments().removeAllObjects(); - _inlineAttachments().removeAllObjects(); - setMimeMessage(new MimeMessage(session())); - } - - protected MimeMessage mimeMessage() { - return _mimeMessage; - } - - protected void setMimeMessage(MimeMessage message) { - _mimeMessage = message; - } - - public void addAttachment(ERMailAttachment attachment) { - _attachments().addObject(attachment); - } - - public void addInlineAttachment(ERMailAttachment attachment) { - _inlineAttachments().addObject(attachment); - } - - protected NSMutableArray _inlineAttachments() { - if (_inlineAttachments == null) - _inlineAttachments = new NSMutableArray(); - return _inlineAttachments; - } - - public NSArray inlineAttachments() { - return _inlineAttachments(); - } - - protected NSMutableArray _attachments() { - if (_attachments == null) - _attachments = new NSMutableArray(); - return _attachments; - } - - public NSArray attachments() { - return _attachments(); - } - - public void removeAttachment(ERMailAttachment attachment) { - _attachments().removeObject(attachment); - _inlineAttachments().removeObject(attachment); - } - - /** - * - * メール・アドレスと名前を InternetAddress としてインスタンス化と戻します - * - * - * @return address object - * @throws AddressException if parsing of email failed - */ - protected InternetAddress internetAddressWithEmailAndPersonal(String email, String personal) throws AddressException { - InternetAddress address = null; - - if (personal != null) { - address = new InternetAddress(); - address.setAddress(email); - - try { - address.setPersonal(personal, charset()); - } - catch (java.io.UnsupportedEncodingException ex) { - // set the string anyway. - try { - address.setPersonal(personal); - } - catch (Exception e) { - // give up ... - } - } - } - else { - address = new InternetAddress(email); - } - - return address; - } - - /** - * - * Sets the from address for the current message instance - * - * - * - * カレント・メッセージ・インスタンスの送信元アドレスをセットします - * - */ - public void setFromAddress(String fromAddress) throws MessagingException, AddressException { - setFromAddress(fromAddress, null); - } - - /** - * - * Sets the from address for the current message instance using an email and the personal name. - * - * - * - * カレント・メッセージ・インスタンスの送信元アドレスと名前をセットします - * - */ - public void setFromAddress(String fromAddress, String personalName) throws MessagingException, AddressException { - InternetAddress address = internetAddressWithEmailAndPersonal(fromAddress, personalName); - mimeMessage().setFrom(address); - } - - /** - * - * カレント・メッセージ・インスタンスの送信先アドレスをセットします - * - */ - public void setToAddress(String toAddress) throws MessagingException, AddressException { - setToAddress(toAddress, null); - } - - /** - * - * Sets the to address for the current message instance using an email and the personal name. - * - * - * - * カレント・メッセージ・インスタンスの送信先アドレスと名前をセットします - * - */ - public void setToAddress(String toAddress, String personalName) throws MessagingException, AddressException { - InternetAddress address = internetAddressWithEmailAndPersonal(toAddress, personalName); - setInternetAddresses(new NSArray(address), Message.RecipientType.TO); - } - - /** - * - * Sets the to-addresses array for the current message instance - * - * - * - * カレント・メッセージ・インスタンスの送信先 NSArray アドレスをセットします - * - */ - public void setToAddresses(NSArray toAddresses) throws MessagingException, AddressException { - setAddresses(toAddresses, Message.RecipientType.TO, true); - } - - /** - * - * Sets the to-addresses array for the current message instance - * - * - * - * カレント・メッセージ・インスタンスの送信先 NSDictionary アドレスをセットします - * - */ - public void setToAddresses(NSDictionary toAddresses) throws MessagingException, AddressException { - setAddresses(toAddresses, Message.RecipientType.TO, true); - } - - /** - * - * Sets the reply-to address for the current message instance - * - * - * - * カレント・メッセージ・インスタンスの Reply To アドレスをセットします - * - */ - public void setReplyToAddress(String toAddress) throws MessagingException, AddressException { - setReplyToAddress(toAddress, null); - } - - /** - * - * Sets the reply-to address for the current message instance - * - * - * - * カレント・メッセージ・インスタンスの Reply To アドレスと名前をセットします - * - */ - public void setReplyToAddress(String toAddress, String personalName) throws MessagingException, AddressException { - InternetAddress addresses[] = new InternetAddress[] { internetAddressWithEmailAndPersonal(toAddress, personalName) }; - mimeMessage().setReplyTo(addresses); - } - - /** - * - * Sets the cc-addresses array for the current message instance - * - * - * - * カレント・メッセージ・インスタンスの CCアドレス NSArray をセットします - * - */ - public void setCCAddresses(NSArray ccAddresses) throws MessagingException, AddressException { - setAddresses(ccAddresses, Message.RecipientType.CC, true); - } - - /** - * - * Sets the cc-addresses array for the current message instance - * - * - * - * カレント・メッセージ・インスタンスの CCアドレス NSDictionary をセットします - * - */ - public void setCCAddresses(NSDictionary ccAddresses) throws MessagingException, AddressException { - setAddresses(ccAddresses, Message.RecipientType.CC, true); - } - - /** - * - * Sets the bcc-addresses array for the current message instance - * - * - * - * カレント・メッセージ・インスタンスの BCCアドレス NSArray をセットします - * - */ - public void setBCCAddresses(NSArray bccAddresses) throws MessagingException, AddressException { - setAddresses(bccAddresses, Message.RecipientType.BCC, true); - } - - /** - * - * Sets the bcc-addresses array for the current message instance - * - * - * - * カレント・メッセージ・インスタンスの BCCアドレス NSDictionary をセットします - * - */ - public void setBCCAddresses(NSDictionary bccAddresses) throws MessagingException, AddressException { - setAddresses(bccAddresses, Message.RecipientType.BCC, true); - } - - /** - * - * Sets the subject for the current message instance - * - * - * - * カレント・メッセージ・インスタンスの題名をセットします - * - * @param subject subject string - * @throws MessagingException if the charset conversion of the subject fails - */ - public void setSubject(String subject) throws MessagingException { - mimeMessage().setSubject(ERMailUtils.encodeString(subject, charset())); - } - - /** - * - * Sets the X-Mailer header for the message. Useful for tracking which mailers are sending messages. - * - * @param xMailer - * value to set - * - * - * - * メッセージの X-Mailer ヘッダーをセットします。 - * どのメールソフトが送信しているかどうかの調査使用します。 - * - * @param xMailer - セットする値 - * - */ - public void setXMailerHeader(String xMailer) throws MessagingException { - mimeMessage().setHeader("X-Mailer", xMailer); - } - - /** - * - * Gets the X-Mailer header set on the MimeMessage. - * - * @return X-Mailer header if it is set - * - * - * - * メッセージの X-Mailer ヘッダーを取得します。 - * - * @return セットされていれば、X-Mailer ヘッダー - * - */ - public String xMailerHeader() throws MessagingException { - String[] headers = mimeMessage().getHeader("X-Mailer"); - return headers != null && headers.length > 0 ? headers[0] : null; - } - - /** - * Sets an additional custom header element for the message. - * - * @param headerKey - * @param value - * value to set - */ - public void setAdditionalHeader(String headerKey, String value) throws MessagingException { - mimeMessage().setHeader(headerKey, value); - } - - /** - * - * Builds an ERMessage for the current MimeMessage. - * - * @return ERMessage for the current MimeMessage. - * - * - * - * カレント MimeMessage のために ERMessage を生成します。 - * - * @return カレント MimeMessage のための ERMessage - * - */ - protected ERMessage buildMessage() { - ERMessage message = new ERMessage(); - message.setDelegate(_delegate); - message.setUserInfo(_userInfo); - message.setContextString(_contextString); - MimeMessage mimeMessage = mimeMessage(); - try { - Address[] bccRecipients = mimeMessage.getRecipients(RecipientType.BCC); - if (bccRecipients != null && bccRecipients.length > 0) { - Address[] toRecipients = mimeMessage.getRecipients(RecipientType.TO); - if (toRecipients == null || toRecipients.length == 0) { - mimeMessage.addRecipient(RecipientType.TO, internetAddressWithEmailAndPersonal("Undisclosed recipients:;", null)); - } - } - } - catch (MessagingException e) { - throw new RuntimeException("Failed to set 'undisclosed recipients' recipient for your bulk mail.", e); - } - message.setMimeMessage(mimeMessage); - return message; - } - - /** - * - * Sends the mail immediately. The message is put in a FIFO queue managed by a static threaded inner class - * - * - * - * メールを直ちに送信します。メッセージは内部スレッド・クラスによる FIFO キューに保存されます。 - * - */ - public void sendMail() { - try { - sendMail(false); - } - catch (NSForwardException e) { - log.warn("Sending mail in a non-blocking manner and a forward exception was thrown.", e); - } - } - - /** - * - * Method used to construct a MimeMessage and then send it. This method can be specified to block until the message - * is sent or to add the message to a queue and have a callback object handle any exceptions that happen. If sending - * is blocking then any exception thrown will be wrapped in a general {@link NSForwardException}. - * - * @param shouldBlock - * boolean to indicate if the message should be added to a queue or sent directly. - * - * - * - * MimeMessage を生成し、送信を試します。 - * このメソッドは送信完了までにブロックするかキューに登録し例外が発生する場合はコールバック・オブジェクトで処理されるかを指定できます。 - * 送信でブロックを使用するとすべての例外は {@link NSForwardException} にラップされます。 - * - * @param shouldBlock - ブロックするかキューを使うかの boolean - * - */ - public void sendMail(boolean shouldBlock) { - try { - if (ERJavaMail.sharedInstance().centralize()) { - if (ERJavaMail.sharedInstance().adminEmail() == null) { - throw new IllegalArgumentException("When setting 'er.javamail.centralize=true' (which means you just test sending mails), you must also give a valid 'er.javamail.adminEmail=foo@bar.com' to which the mails are sent."); - } - InternetAddress[] addresses = new InternetAddress[] { new InternetAddress(ERJavaMail.sharedInstance().adminEmail()) }; - mimeMessage().setRecipients(Message.RecipientType.TO, addresses); - mimeMessage().setRecipients(Message.RecipientType.CC, new InternetAddress[0]); - mimeMessage().setRecipients(Message.RecipientType.BCC, new InternetAddress[0]); - } - if (mimeMessage().getAllRecipients().length == 0) { - return; - } - - finishMessagePreparation(); - ERMailSender sender = ERMailSender.sharedMailSender(); - ERMessage message = buildMessage(); - - if (shouldBlock) - sender.sendMessageNow(message); - else { - // add the current message to the message stack - boolean mailAccepted = false; - while (!mailAccepted) { - try { - sender.sendMessageDeffered(message); - mailAccepted = true; - } - catch (ERMailSender.SizeOverflowException e) { - // The mail sender is overflowed, we need to wait - try { - // Ask the current thread to stop - // computing for a little while. - // Here, we make the assumption that - // the current thread is the one that - // feeds the ERMailSender. - Thread.sleep(ERJavaMail.sharedInstance().milliSecondsWaitIfSenderOverflowed()); - } - catch (InterruptedException ie) { - log.warn("Caught InterruptedException.", ie); - } - } - } - } - } - catch (MessagingException e) { - log.warn("MessagingException exception caught, re-throwing exception.", e); - throw new NSForwardException(e); - } - finally { - setMimeMessage(null); - } - } - - protected void finishMessagePreparation() throws MessagingException { - DataHandler messageDataHandler = prepareMail(); - - // Add all the attachements to the javamail message - if (attachments().count() > 0) { - // Create a Multipart that will hold the prepared multipart and the attachments - MimeMultipart multipart = new MimeMultipart(); - - // Create the main body part - BodyPart mainBodyPart = new MimeBodyPart(); - mainBodyPart.setDataHandler(messageDataHandler); - - // add the main body part to the content of the message - multipart.addBodyPart(mainBodyPart); - - // add each attachments to the former multipart - for (ERMailAttachment attachment : attachments()) { - BodyPart bp = attachment.getBodyPart(); - bp.setDisposition(Part.ATTACHMENT); - multipart.addBodyPart(bp); - } - - mimeMessage().setContent(multipart); - } - else { - mimeMessage().setDataHandler(messageDataHandler); - } - - // If the xMailer property has not been set, check if one has been provided - // in the System properties - if ((xMailerHeader() == null) && (ERJavaMail.sharedInstance().defaultXMailerHeader() != null)) { - setXMailerHeader(ERJavaMail.sharedInstance().defaultXMailerHeader()); - } - - mimeMessage().setSentDate(new Date()); - mimeMessage().saveChanges(); - } - - /** - * - * Sets addresses using an NSArray of InternetAddress objects. - * - * - * - * InternetAddress オブジェクトの NSArray をセットします - * - */ - public void setInternetAddresses(NSArray addresses, Message.RecipientType type) throws MessagingException { - if ((type == null) || (addresses == null) || (addresses.count() == 0)) { - // don't do anything. - return; - } - - InternetAddress[] internetAddresses = new InternetAddress[addresses.count()]; - for (int i = 0; i < addresses.count(); i++) { - internetAddresses[i] = addresses.objectAtIndex(i); - } - - mimeMessage().setRecipients(type, internetAddresses); - } - - /** - * - * Sets addresses regarding their recipient type in the current message. Has the option to filter the address list - * based on the white and black lists. - * - * - * - * カレント・メッセージの送信宛先タイプのアドレスをセットします。 - * オプションでホワイト&ブラック・リスト・フィルターされる - * - */ - private void setAddresses(NSArray addressesArray, Message.RecipientType type, boolean filterAddresses) throws MessagingException, AddressException { - if (filterAddresses) { - addressesArray = ERJavaMail.sharedInstance().filterEmailAddresses(addressesArray); - } - if (addressesArray.count() == 0) { - // don't do anything. - return; - } - InternetAddress[] addresses = ERMailUtils.convertNSArrayToInternetAddresses(addressesArray); - mimeMessage().setRecipients(type, addresses); - } - - /** - * - * Sets addresses regarding their recipient type in the current message. Has the option to filter the address list - * based on the white and black lists. - * - * - * - * カレント・メッセージの送信宛先タイプのアドレスをセットします。 - * オプションでホワイト&ブラック・リスト・フィルターされる - * - */ - private void setAddresses(NSDictionary addressesDictionary, Message.RecipientType type, boolean filterAddresses) throws MessagingException, AddressException { - NSArray mailAdresses = addressesDictionary.allKeys(); - if (filterAddresses) { - mailAdresses = ERJavaMail.sharedInstance().filterEmailAddresses(mailAdresses); - } - if (mailAdresses.count() == 0) { - // don't do anything. - return; - } - NSMutableDictionary newDictionary = new NSMutableDictionary(); - for (String key: mailAdresses) { - newDictionary.takeValueForKey(addressesDictionary.objectForKey(key), key); - } - InternetAddress[] addresses = ERMailUtils.convertNSDictionaryToInternetAddresses(newDictionary.immutableClone(), charset()); - mimeMessage().setRecipients(type, addresses); - } - - /** - * - * Abstract method called by subclasses for doing pre-processing before sending the mail. - * - * @return the multipart used to put in the mail. - * - * - * - * メールを送信前の処理のサブクラスの抽選メソッド - * - * @return メールのマルチパート - * - */ - protected abstract DataHandler prepareMail() throws MessagingException; -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryComponentBased.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryComponentBased.java deleted file mode 100644 index 4d0a0a12dfb..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryComponentBased.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - ERMailDeliveryComponentBased.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import com.webobjects.appserver.WOComponent; -import com.webobjects.appserver.WOContext; -import com.webobjects.appserver.WOMessage; -import com.webobjects.foundation.NSDictionary; - -/** - * - * This abstract class is the basis for all WOComponetn based deliverers. - * - * - * - * この抽選クラスは WOComponent のメール対応のスーパー・クラスになります。 - * - * - * @author Camille Troillard - */ -public abstract class ERMailDeliveryComponentBased extends ERMailDelivery { - /** WOComponent used to render the HTML message. */ - protected WOComponent _component; - protected WOComponent _alternativeComponent; - - /** - * - * Variable that stores the state of the session. In the case the component was instanciated with - * ERMailUtils.instanciatePage, the session may be new and hence, would lack its dictionary properties. - * - * - * - * セッション情報を保持する変数です。例えば、ERMailUtils.instanciatePage でインスタンス化されているコンポーネント - * ではセッションが新しく、必要な情報がないことになります。 - * - */ - protected NSDictionary _sessionDictionary = NSDictionary.EmptyDictionary; - - /** - * Sets the WOComponent used to render the HTML message. - * - * @deprecated use {@link #setComponent(WOComponent)} - */ - @Deprecated - public void setWOComponentContent(WOComponent component) { - setComponent(component); - } - - /** - * - * Sets the WOComponent used to render the HTML message. - * - * - * - * HTML メッセージに使用される WOComponent をセットします。 - * - */ - public void setComponent(WOComponent component) { - _component = component; - } - - public WOComponent component() { - return _component; - } - - /** - * - * Sets the alternative view component for rendering a different mime type (text/plain, etc) - * - * - * - * 他の mime タイプ (text/plain, 等) のレンダリングに使用するコンポーネント - * - */ - public void setAlternativeComponent(WOComponent alternativeComponent) { - _alternativeComponent = alternativeComponent; - } - - public WOComponent alternativeComponent() { - return _alternativeComponent; - } - - /** Accessor for the sessionDictionary property */ - public NSDictionary sessionDictionary() { - return _sessionDictionary; - } - - /** Accessor for the sessionDictionary property */ - public void setSessionDictionary(NSDictionary dict) { - _sessionDictionary = dict; - } - - /** - * - * Generates the output string used in messages - * - * - * - * メッセージで使用されている出力結果を生成します - * - */ - protected String componentContentString() { - return _componentContentString(component()); - } - - /** - * - * Generates the output string used in messages - * - * - * メッセージで使用されている出力結果を生成します - * - */ - protected String alternativeComponentContentString() { - return _componentContentString(alternativeComponent()); - } - - /** - * - * Generates the output string used in messages - * - * - * - * メッセージで使用されている出力結果を生成します - * - */ - protected String _componentContentString(WOComponent component) { - String contentString = null; - if (component != null) { - WOContext context = component.context(); - - // CHECKME: It's probably not a good idea to do this here - // since the context could also have been generating relative URLs - // unless the context is created from scratch - context.generateCompleteURLs(); - WOMessage response = component.generateResponse(); - contentString = response.contentString(); - } - return contentString; - } - -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryHTML.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryHTML.java deleted file mode 100644 index 087f5701cf4..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryHTML.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - ERMailDeliveryHTML.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import java.util.Date; - -import javax.activation.DataHandler; -import javax.mail.BodyPart; -import javax.mail.MessagingException; -import javax.mail.internet.MimeBodyPart; -import javax.mail.internet.MimeMultipart; - -/** - * - * This ERMailDelivery subclass is specifically crafted for HTML messages using a WOComponent as rendering device. - * - * - * - * HTML メッセージに使用する ERMailDelivery サブクラス - * - * - * @author Camille Troillard - */ -public class ERMailDeliveryHTML extends ERMailDeliveryComponentBased { - protected static Factory factory; - - /** Holds the HTML content */ - protected String _htmlContent; - - /** - * Plain text preamble set in top of HTML source so that non-HTML compliant mail readers can at least display this - * message. - */ - private String _hiddenPlainTextContent; - - /** - * - * Gets the current factory. If the factory is unset, sets it to the default factory. - * - * @return the current factory - * - * - * - * カレント・ファクトリーを戻します。 - * ファクトリーがセットされていない場合、デフォルト・ファクトリーが使用される - * - * @return カレント・ファクトリー - * - */ - public static Factory factory() { - if (factory == null) - factory = new DefaultFactory(); - - return factory; - } - - /** - * - * Sets the factory. - * - * @param value - * the factory to use - * - * - * - * ファクトリーをセットします。 - * - * @param value - 使用されるファクトリー - * - */ - public static void setFactory(Factory value) { - factory = value; - } - - public static ERMailDeliveryHTML newMailDelivery() { - return factory().newHTMLMailDelivery(); - } - - /** - * - * Sets the Plain text preamble that will be displayed set in top of HTML source. Non-HTML compliant mail readers - * can at least display this message. - * - * - * - * HTML ソースの前に標準テキストをセットします。 - * HTML 表示が不可能なメール・ソフトウェアでも標準テキストが表示できるようになります。 - * - */ - public void setHiddenPlainTextContent(String content) { - _hiddenPlainTextContent = content; - } - - /** - * - * Sets the HTML content. Note that if you set the WOComponent to be used when rendering the message this content - * will be ignored. - * - * @param content - * HTML content to be used - * - * - * - * HTML コンテントをセットします。 - * 注意:レンダリングに WOComponent を使用される場合にはこのコンテントが無視されます。 - * - * @param content - 使用される HTML コンテント - * - */ - public void setHTMLContent(String content) { - _htmlContent = content; - } - - /** - * - * Creates a new mail instance within ERMailDelivery. Sets hasHiddenPlainTextContent to false. - * - * - * - * ERMailDelivery の新規メール・インスタンスを作成します。hasHiddenPlainTextContent を null にします。 - * - */ - @Override - public void newMail() { - super.newMail(); - _hiddenPlainTextContent = null; - setHTMLContent(null); - } - - protected String htmlContent() { - String htmlContent = null; - if (component() != null) { - htmlContent = componentContentString(); - } - else { - htmlContent = _htmlContent; - } - return htmlContent; - } - - /** - * - * Pre-processes the mail before it gets sent. - * - * - * - * メールが送信される前の前処理 - * - * @see ERMailDelivery#prepareMail() - * - */ - @Override - protected DataHandler prepareMail() throws MessagingException { - MimeMultipart multipart = null; - MimeBodyPart textPart = null; - MimeBodyPart htmlPart = null; - - mimeMessage().setSentDate(new Date()); - multipart = new MimeMultipart("alternative"); - - // set the plain text part - String textContent; - if (_hiddenPlainTextContent != null) { - textContent = _hiddenPlainTextContent; - } - else { - textContent = alternativeComponentContentString(); - } - - if (textContent != null) { - textPart = new MimeBodyPart(); - textPart.setText(textContent + "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", charset()); - multipart.addBodyPart(textPart); - } - - // create and fill the html message part - htmlPart = new MimeBodyPart(); - - // Set the content of the html part - htmlPart.setContent(htmlContent(), "text/html; charset=\"" + charset() + "\""); - - // Inline attachements - if (inlineAttachments().count() == 0) { - multipart.addBodyPart(htmlPart); - } - else { - // Create a "related" MimeMultipart - MimeMultipart relatedMultiparts = new MimeMultipart("related"); - relatedMultiparts.addBodyPart(htmlPart); - - // add each inline attachments to the message - for (ERMailAttachment attachment : inlineAttachments()) { - BodyPart bp = attachment.getBodyPart(); - relatedMultiparts.addBodyPart(bp); - } - - // Add this multipart to the main multipart as a compound BodyPart - BodyPart relatedAttachmentsBodyPart = new MimeBodyPart(); - relatedAttachmentsBodyPart.setDataHandler(new DataHandler(relatedMultiparts, relatedMultiparts.getContentType())); - multipart.addBodyPart(relatedAttachmentsBodyPart); - } - - return new DataHandler(multipart, multipart.getContentType()); - } - - public static interface Factory { - /** - * - * Vends a new instance of an HTML mail delivery. - * - * @return a new instance - * - * - * - * HTML メールの新規インスタンスを作成します。 - * - * @return 新規インスタンス - * - */ - public ERMailDeliveryHTML newHTMLMailDelivery(); - } - - /** - * - * The default factory. Vends the ERMailDeliveryHTML object back. - * - * - * - * デフォルト・ファクトリー - * ERMailDeliveryHTML オブジェクトが戻ります。 - * - */ - public static class DefaultFactory implements Factory { - public ERMailDeliveryHTML newHTMLMailDelivery() { - return new ERMailDeliveryHTML(); - } - } - -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryPlainText.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryPlainText.java deleted file mode 100644 index 3ab6dfa9396..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryPlainText.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - ERMailDeliveryPlainText.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import javax.activation.DataHandler; - -/** - * - * This ERMailDelivery subclass is specifically crafted for plain text messages. - * - * - * - * 標準テキスト・メッセージに使用する ERMailDelivery サブクラス - * - * - * @author Camille Troillard - */ -public class ERMailDeliveryPlainText extends ERMailDelivery { - - /** Designated constructor */ - public ERMailDeliveryPlainText(javax.mail.Session session) { - super(session); - } - - /** Default constructor */ - public ERMailDeliveryPlainText() { - super(); - } - - /** String Message content */ - private String textContent; - - /** Sets the text content of the current message. */ - public void setTextContent(String text) { - textContent = text; - } - - /** - * - * Pre-processes the mail before it gets sent. - * - * - * - * 送信前に前処理を行います。 - * - * - * @see ERMailDelivery#prepareMail() - */ - @Override - protected DataHandler prepareMail() { - String charset = charset(); - DataHandler dataHandler; - if (charset != null) { - dataHandler = new DataHandler(textContent, "text/plain; charset=\"" + charset() + "\""); - } - else { - dataHandler = new DataHandler(textContent, "text/plain"); - } - return dataHandler; - } - -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryWOComponentPlainText.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryWOComponentPlainText.java deleted file mode 100755 index 55be3ff86db..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailDeliveryWOComponentPlainText.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - ERMailDeliveryWOComponentPlainText.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import javax.activation.DataHandler; - -/** - * - * This ERMailDelivery subclass is specifically crafted for plain text messages using a WOComponent as rendering device. - * - * - * - * レンダリングに WOComponent を使用する場合の標準テキスト・メッセージの ERMailDelivery サブクラス - * - * - * @author Camille Troillard - */ -public class ERMailDeliveryWOComponentPlainText extends ERMailDeliveryComponentBased { - - /** - * - * Pre-processes the mail before it gets sent. - * - * - * - * 送信前に前処理を行います。 - * - * - * @see ERMailDelivery#prepareMail() - */ - @Override - protected DataHandler prepareMail() { - String messageContent = componentContentString(); - return new DataHandler(messageContent, "text/plain; charset=\"" + charset() + "\""); - } -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailFileAttachment.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailFileAttachment.java deleted file mode 100644 index bc433b3556f..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailFileAttachment.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - ERMailFileAttachment.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import java.io.File; - -import javax.activation.DataHandler; -import javax.activation.DataSource; -import javax.activation.FileDataSource; -import javax.mail.BodyPart; -import javax.mail.MessagingException; -import javax.mail.internet.MimeBodyPart; - -public class ERMailFileAttachment extends ERMailAttachment { - - protected String _fileName; - protected String _contentID; - - protected ERMailFileAttachment(Object content) { - super(content); - } - - public ERMailFileAttachment(String fileName, String id, File content) { - super(content); - _fileName = fileName; - _contentID = id; - } - - /** - * - * ファイル名を取得します。 - * 設定されていなければ、"attachement.txt" が戻ります。 - * - * @return ファイル名 - * - */ - public String fileName() { - if (_fileName == null) - _fileName = "attachement.txt"; - return _fileName; - } - - /** - * - * ファイル名をセットします。 - * - * @param name - ファイル名 - * - */ - public void setFileName(String name) { - _fileName = name; - } - - /** - * - * コンテント ID を取得します。 - * - * @return コンテント ID - * - */ - public String contentID() { - return _contentID; - } - - /** - * - * コンテント ID をセットします。 - * - * @param id - コンテント ID - * - */ - public void setContentID(String id) { - _contentID = id; - } - - @Override - protected BodyPart getBodyPart() throws MessagingException { - MimeBodyPart bp = new MimeBodyPart(); - DataSource ds = new FileDataSource((File) content()); - bp.setDataHandler(new DataHandler(ds)); - - if (contentID() != null) - bp.setHeader("Content-ID", contentID()); - bp.setFileName(fileName()); - - return bp; - } -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailSender.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailSender.java deleted file mode 100644 index 38ce9a66d62..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailSender.java +++ /dev/null @@ -1,610 +0,0 @@ -/* - ERMailSender.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import java.net.ConnectException; -import java.net.UnknownHostException; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; - -import javax.mail.AuthenticationFailedException; -import javax.mail.MessagingException; -import javax.mail.SendFailedException; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.MimeMessage; - -import org.apache.log4j.Logger; - -import com.webobjects.appserver.WOApplication; -import com.webobjects.foundation.NSArray; -import com.webobjects.foundation.NSForwardException; -import com.webobjects.foundation.NSNotification; -import com.webobjects.foundation.NSNotificationCenter; -import com.webobjects.foundation.NSTimestamp; - -import er.extensions.formatters.ERXUnitAwareDecimalFormat; - -/** - * - * This class is used to send mails in a threaded way. - * - * This is needed in WebObjects because if sending 20 mails takes 40 seconds, then the user must wait 40 seconds before - * attempting to use the application. - * - * - * - * このクラスはメール送信をスレッド系で送信します。 - * WebObjects には必要な方法です。なぜなら、メール 20通が約 40秒かかるとユーザが 40秒もアプリケーションが使えるようになるまでに - * 待つ必要が発生します。 - * - * - * @author Camille Troillard - * @author Tatsuya Kawano - * @author Max Muller - */ -public class ERMailSender implements Runnable { - - public static final String InvalidEmailNotification = "InvalidEmailNotification"; - - static Logger log = Logger.getLogger(ERMailSender.class); - - private static ERMailSender _sharedMailSender; - - private Stats _stats; - - // Holds sending messages. The queue size can be set by - // er.javamail.senderQueue.size property - private ERQueue _messages; - // For thread management - private int _milliSecondsWaitRunLoop = 5000; - - private Thread _senderThread; - - /** - * - * Exception class for alerting about a stack overflow - * - * - * - * オーバフローの例外発生クラス - * - */ - public static class SizeOverflowException extends Exception { - private static final long serialVersionUID = 1L; - - public SizeOverflowException(Exception e) { - super(e); - } - } - - private ERMailSender() { - _stats = new Stats(); - _messages = new ERQueue(ERJavaMail.sharedInstance().senderQueueSize()); - - if (WOApplication.application() == null || WOApplication.application ().isDebuggingEnabled()) { - _milliSecondsWaitRunLoop = 2000; - } - - if (log.isDebugEnabled()) { - log.debug("ERMailSender initialized (JVM heap size: " + _stats.formattedUsedMemory() + ")"); - } - } - - /** - * - * @return the shared instance of the singleton ERMailSender object - * - * - * - * @return ERMailSender シングルトン・オブジェクトを戻します。 - * - */ - public static synchronized ERMailSender sharedMailSender() { - if (_sharedMailSender == null) { - _sharedMailSender = new ERMailSender(); - } - return _sharedMailSender; - } - - /** - * - * @return the stats associated with this ERMailSender object - * - * - * - * @return ERMailSender オブジェクトと関連されている統計を戻します - * - */ - public Stats stats() { - return _stats; - } - - /** - * - * Sends a message in a non-blocking way. - * - * This means that the thread won't be blocked, but the message will be queued before being delivered. - * - * - * - * メッセージをブロックされない形で送信します。
- * スレッドはブロックされませんが、メッセージは送信する前にキューに入れられます。 - *
- */ - public void sendMessageDeffered(ERMessage message) throws ERMailSender.SizeOverflowException { - try { - String allRecipientsString = null; - if (log.isDebugEnabled()) { - try { - allRecipientsString = message.allRecipientsAsString(); - } - catch (MessagingException ex) { - allRecipientsString = "(not available)"; - } - // log.debug ("Adding a message in the queue: \n" + allRecipientsString); - } - - _messages.push(message); - _stats.updateMemoryUsage(); - - if (log.isDebugEnabled()) - log.debug("(" + _stats.formattedUsedMemory() + ") Added the message in the queue: " + allRecipientsString); - } - catch (ERQueue.SizeOverflowException e) { - throw new ERMailSender.SizeOverflowException(e); - } - - synchronized (_messages) { - // If we have not started to send mails, start the thread - if (_senderThread == null) { - _senderThread = new Thread(this, "ERMailSender"); - _senderThread.setPriority(Thread.MIN_PRIORITY); - _senderThread.start(); - } - else { - _messages.notifyAll(); - } - } - } - - /** - * - * Sends a message immediately. - * - * This means that the thread could be blocked if the message takes time to be delivered. - * - * - * - * メッセージを直ちに送信する
- * メッセージが送信に時間がかかりすぎるとスレッドがブロックされる可能性があります。 - *
- */ - public void sendMessageNow(ERMessage message) { - Transport transport = null; - try { - transport = _connectedTransportForSession(ERJavaMail.sharedInstance().sessionForContext(message.contextString()), ERJavaMail.sharedInstance().smtpProtocolForContext(message.contextString()), false); - _sendMessageNow(message, transport); - } - catch (MessagingException e) { - if (log.isDebugEnabled()) { - log.debug("Caught exception when sending mail in a non-blocking manner.", e); - } - throw NSForwardException._runtimeExceptionForThrowable(e); - } - finally { - // CHECKME (camille): - // Should we really close this default transport instance? - // I think there is no need to do so and that it should be closed - // when the ERMailSender is finalized - if (transport != null) { - try { - transport.close(); - } - catch (MessagingException e) { - // Fatal exception ... we must at least notify the use - log.error("Caught exception when closing transport.", e); - throw NSForwardException._runtimeExceptionForThrowable(e); - } - } - } - } - - /** - * - * Common method used by 'sendMessageNow' and 'sendMessageDeffered' (actully the 'run' method when the thread is - * running) to send a message. - * - * This method sends the message and increments the processed mail count. If an exception occurs while sending the - * mail, and if a callback object has been given, the notifyInvalidEmails method is called.
- * If a MessagingException is thrown, then the exception is catched and rethrown immediately, thus letting us to - * process another callbacks or not. For example, This is used when sendMessageNow is used, the MessagingException - * is encapsulated in a ERMailSender.ForwardException, and thrown to the user. - *
- * - * - * 'sendMessageNow' と 'sendMessageDeffered' (実際は 'run' メソッド) のメール送信共通メソッドです。
- * このメソッドはメッセージを送信し、メール送信カウンターを進みます。メール送信中に例外が発生するとコールバック指定があれば、 - * notifyInvalidEmails メソッドがコールされます。
- * MessagingException が発生すると例外がキャチュされ、再度発生させます。他のコールバックを対応できるようになります。 - * 例えば、sendMessageNow が使用されている時 MessagingException は ERMailSender.ForwardException 内にカプセル化されます。 - *
- */ - protected void _sendMessageNow(ERMessage message, Transport transport) throws MessagingException { - boolean debug = log.isDebugEnabled(); - MimeMessage aMessage = message.mimeMessage(); - MessagingException exception = null; - - if (message.shouldSendMessage()) { - // Send the message - try { - - if (debug) { - log.debug("Sending a message ... " + aMessage); - Enumeration e = aMessage.getAllHeaderLines(); - while (e.hasMoreElements()) { - String header = e.nextElement(); - log.debug(header); - } - } - transport.sendMessage(aMessage, aMessage.getAllRecipients()); - message._deliverySucceeded(); - if (debug) - log.debug("Done."); - _stats.updateMemoryUsage(); - - if (debug) { - String allRecipientsString = null; - try { - allRecipientsString = message.allRecipientsAsString(); - } - catch (MessagingException ex) { - allRecipientsString = "(not available)"; - } - log.debug("(" + _stats.formattedUsedMemory() + ") Message sent: " + allRecipientsString); - } - } - catch (SendFailedException e) { - if (debug) - log.debug("Failed to send message: \n" + message.allRecipientsAsString() + e.getMessage()); - _stats.incrementErrorCount(); - - NSArray invalidEmails = ERMailUtils.convertInternetAddressesToNSArray(e.getInvalidAddresses()); - notifyInvalidEmails(invalidEmails); - message._invalidRecipients(invalidEmails); - - exception = e; - } - catch (MessagingException e) { - exception = e; - } - catch (Throwable t) { - log.error("An unexpected error occured while sending message: " + message + " mime message: " + aMessage - + " sending to: " + Arrays.toString(aMessage.getAllRecipients()) + " transport: " + transport, t); - // Need to let someone know that something very, very bad happened - message._deliveryFailed(t); - throw NSForwardException._runtimeExceptionForThrowable(t); - } - finally { - _stats.incrementMailCount(); - if (exception != null) { - message._deliveryFailed(exception); - throw exception; - } - } - } - else if (log.isDebugEnabled()) { - log.debug("Message has instructed me not to send it, not sending message: " + message); - } - } - - /** - * - * Utility method that gets the SMTP Transport method for a session and connects the Transport before returning it. - * - * - * - * セッションの SMTP トランスポート方法を取得するユーティリティー・メソッド。 - * 戻す前にトランスポートへの接続を開始します。 - * - */ - protected Transport _connectedTransportForSession(javax.mail.Session session, String smtpProtocol, boolean _throwExceptionIfConnectionFails) throws MessagingException { - Transport transport = null; - try { - transport = session.getTransport(smtpProtocol); - if (!transport.isConnected()) { - String userName = session.getProperty("mail." + smtpProtocol + ".user"); - String password = session.getProperty("mail." + smtpProtocol + ".password"); - if (userName != null && password != null) { - transport.connect(session.getProperty("mail." + smtpProtocol + ".host"), userName, password); - } - else { - transport.connect(); - } - } - } catch (MessagingException e) { - log.error("Unable to connect to SMTP Transport. MessagingException: " + e.getMessage(), e); - if (_throwExceptionIfConnectionFails) { - throw e; - } else { - log.error("Unable to connect to SMTP Transport. MessagingException: " + e.getMessage(), e); - } - } - - return transport; - } - - /** - * - * Don't call this method, this is the thread run loop and is automatically called. - * - * - * - * このメソッドをコールしないでください。 - * これはスレッド実行ループで自動的に処理されます。 - * - */ - public void run() { - try { - while (true) { - synchronized (_messages) { - while (_messages.empty()) { - _messages.wait(_milliSecondsWaitRunLoop); - } - } - - // If there are still messages pending ... - if (!_messages.empty()) { - Map transports = new HashMap(); - - try { - while (!_messages.empty()) { - ERMessage message = _messages.pop(); - String contextString = message.contextString(); - String smtpProtocol = ERJavaMail.sharedInstance().smtpProtocolForContext(contextString); - if (contextString == null) { - contextString = "___DEFAULT___"; - } - Transport transport = transports.get(contextString); - if (transport == null) { - Session session = ERJavaMail.sharedInstance().newSessionForMessage(message); - try { - transport = _connectedTransportForSession(session, smtpProtocol, true); - } - catch (MessagingException e) { - message._deliveryFailed(e); - throw e; - } - transports.put(contextString, transport); - } - try { - if (!transport.isConnected()) { - transport.connect(); - } - } catch (MessagingException e) { - // Notify error in logs - log.error ("Unable to connect transport.", e); - - message._deliveryFailed(e); - - // Exit run loop - throw new RuntimeException ("Unable to connect transport.", e); - } - try { - _sendMessageNow(message, transport); - } catch(SendFailedException ex) { - log.error("Can't send message: " + message + ": " + ex, ex); - } - // if (useSenderDelay) { - // wait (senderDelayMillis); - // } - // Here we get all the exceptions that are - // not 'SendFailedException's. - // All we can do is warn the admin. - } - } - catch (AuthenticationFailedException e) { - log.error("Unable to connect to SMTP Transport. AuthenticationFailedException: " + e.getMessage() + " waiting 20 seconds", e); - Thread.sleep(20000); - } - catch (MessagingException e) { - if (e.getNextException() instanceof ConnectException) { - log.error("Can't connect to mail server, waiting"); - Thread.sleep(10000); - } else if (e.getNextException() instanceof UnknownHostException) { - log.error("Can't find to mail server, exiting"); - return; - } else { - log.error("General mail error: " + e, e); - } - } - finally { - for (Transport transport : transports.values()) { - try { - if (transport != null) { - transport.close(); - } - } catch (MessagingException e) /* once again ... */ { - log.warn ("Unable to close transport. Perhaps it has already been closed?", e); - } - } - } - } - } - } - catch (InterruptedException e) { - log.warn("ERMailSender thread has been interrupted."); - //return; - } - // assures the thread will get restarted next time around. - _senderThread = null; - } - - public ERQueue messages() { - return _messages; - } - - /** - * - * Executes the callback method to notify the calling application of any invalid emails. - * - * - * - * メール送信失敗のアプリケーションのコールバックを実行します。 - * - */ - protected void notifyInvalidEmails(NSArray invalidEmails) { - NSNotification notification = new NSNotification(InvalidEmailNotification, invalidEmails); - NSNotificationCenter.defaultCenter().postNotification(notification); - } - - /** - * - * This class is about logging mail event for stats purposes. More stats to come in the future. - * - * - * - * このクラスはメール・イベントを統計のためにログします。 - * - */ - public class Stats { - private NSTimestamp lastResetTime = new NSTimestamp(); - private int errorCount = 0; - private int mailCount = 0; - private double _peakMemoryUsage = 0.0d; - private Runtime _runtime; - private ERXUnitAwareDecimalFormat _decimalFormatter; - - public Stats() { - _decimalFormatter = new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE); - _decimalFormatter.setMaximumFractionDigits(2); - _runtime = Runtime.getRuntime(); - updateMemoryUsage(); - } - - /** - * - * Resets statistics information - * - * - * - * 統計情報のリセット - * - */ - public synchronized void reset() { - String savedStatsString = toString(); - errorCount = 0; - mailCount = 0; - _peakMemoryUsage = 0.0d; - updateMemoryUsage(); - lastResetTime = new NSTimestamp(); - if (log.isDebugEnabled()) - log.debug(savedStatsString + " has been reset to initial value."); - } - - /** - * - * @return the number of errors that were encountered during mail sending process - * - * - * - * @return メール送信中に発生されているエラー・カウントを戻します。 - * - */ - public synchronized int errorCount() { - return errorCount; - } - - /** - * - * @return the total count of mails being sent. This number does not take in accordance the number of errors. To - * get the actual count of mail sent without error use 'errorCount - mailCount'. - * - * - * - * @return 送信メールの合計を戻します。エラー・メールを含む「'errorCount - mailCount' = 送信成功メール」 - * - */ - public synchronized int mailCount() { - return mailCount; - } - - /** - * - * @return the current queue size. This method is useful for simplistic load balancing between apps that are - * supposed to send mails - * - * - * - * @return カレント・キュー・サイズを戻します。複数のアプリケーションのロード・バランスに最適です。 - * - */ - public synchronized int currentQueueSize() { - return _messages.size(); - } - - private synchronized void incrementErrorCount() { - errorCount++; - } - - private synchronized void incrementMailCount() { - mailCount++; - } - - /** - * - * @return the timestamp that respresents when the stats object was reset. - * - * - * - * @return 統計オブジェクトがリセットされているタイムスタンプ - * - */ - public NSTimestamp lastResetTime() { - return lastResetTime; - } - - private void updateMemoryUsage() { - long currentMemoryUsed = usedMemory(); - if (currentMemoryUsed > _peakMemoryUsage) - _peakMemoryUsage = currentMemoryUsed; - } - - public long usedMemory() { - long totalMemory = _runtime.totalMemory(); - long freeMemory = _runtime.freeMemory(); - long usedMemory = totalMemory - freeMemory; - return usedMemory; - } - - public String formattedUsedMemory() { - return _decimalFormatter.format(usedMemory()); - } - - public double peakMemoryUsage() { - return _peakMemoryUsage; - } - - public String formattedPeakMemoryUsage() { - return _decimalFormatter.format(_peakMemoryUsage); - } - - /** - * - * @return a string representation of the Stats object. - * - * - * - * @return 統計オブジェクトの文字列表記 - * - */ - @Override - public String toString() { - return "<" + getClass().getName() + " lastResetTime: " + lastResetTime() + ", mailCount: " + mailCount() + ", errorCount: " + errorCount() + ", currentQueueSize: " + currentQueueSize() + ", peakMemoryUsage: " + formattedPeakMemoryUsage() + ">"; - } - } -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailTextAttachment.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailTextAttachment.java deleted file mode 100644 index e3afaae6029..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailTextAttachment.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - ERMailTextAttachment.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import javax.mail.BodyPart; -import javax.mail.MessagingException; -import javax.mail.internet.MimeBodyPart; - -public class ERMailTextAttachment extends ERMailFileAttachment { - - public ERMailTextAttachment(String fileName, String content) { - super(content); - _fileName = fileName; - } - - @Override - protected BodyPart getBodyPart() throws MessagingException { - MimeBodyPart bp = new MimeBodyPart(); - - bp.setText((String) content(), ERMailDelivery.DefaultCharset); - bp.setFileName(fileName()); - - return bp; - } -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailUtils.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailUtils.java deleted file mode 100644 index e8add1629e8..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMailUtils.java +++ /dev/null @@ -1,437 +0,0 @@ -/* - ERMailUtils.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import java.util.Enumeration; - -import javax.mail.Address; -import javax.mail.internet.AddressException; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeUtility; - -import org.apache.log4j.Logger; - -import com.webobjects.appserver.WOComponent; -import com.webobjects.appserver.WOSession; -import com.webobjects.foundation.NSArray; -import com.webobjects.foundation.NSDictionary; -import com.webobjects.foundation.NSMutableArray; - -import er.extensions.appserver.ERXApplication; - -/** - * - * ERMailUtils contains various utility method related to mail sending. - * - * - * - * ERMailUtils はメール送信の為のユーティリティー・メソッド集 - * - * - * @author Camille Troillard - * @version $Id$ - */ -public class ERMailUtils { - - /** The class logger. */ - private static Logger log = Logger.getLogger(ERMailUtils.class); - - /** - * - * The shared mail deliverer - * - * - * - * メール配信の共有インスタンス - * - */ - private static ERMailDeliveryHTML sharedDeliverer; - - /** - * - * Accessor to the shared instance of a ERMailDeliveryHTML. - * - * @return the ERMailDeliveryHTML singleton - * - * - * - * 共有インスタンス ERMailDeliveryHTML へのアクセス - * - * @return ERMailDeliveryHTML シングルトン - * - */ - public static ERMailDeliveryHTML sharedDeliverer() { - if (sharedDeliverer == null) { - sharedDeliverer = ERMailDeliveryHTML.newMailDelivery(); - } - - return sharedDeliverer; - } - - /** - * - * Augmented version of the method found in {@link ERXApplication}. Used to instantiate a WOComponent, typically - * outside of a session. - * - * @param pageName - * The name of the WOComponent that must be instantiated. - * @param sessionDict - * can be provided in order to set objects/keys in the newly created session of the component. This is - * useful when one want to preserve state when sending a mail. - * @return a newly instantiated WOComponent. - * - * - * - * {@link ERXApplication} 内にある同名メソッドの拡張版。 - * セッションの外側のインスタンス化に使用します。 - * - * @param pageName - インスタンス化する WOComponent 名 - * @param sessionDict - コンポーネントのために、新規作成されるセッションにセットする「オブジェクト/キー」 - * メール送信にセッション情報が必要な場合に有効です。 - * - * @return 新規のインスタンス済み WOComponent - * - */ - public static WOComponent instantiatePage(String pageName, NSDictionary sessionDict) { - WOComponent component = ERXApplication.instantiatePage(pageName); - if (sessionDict != null) { - setDictionaryValuesInSession(sessionDict, component.session()); - } - - return component; - } - - /** - * - * Use this method to send an HTML mail. - * - * @param delivery - * the ERMailDeliveryHTML used to send the mail. - * @param pageName - * The name of the WOComponent that must be instantiated. - * @param alternatePageName - * The name of the WOComponent that represents for the text that must be displayed when an alternate - * plain text version of the mail needs to be provided. - * @param emailFrom - * the email address the mail is sent from - * @param emailTo - * the email address the mail is sent to - * @param emailReplyTo - * the email address where the mail must be replied-to. - * @param subject - * the subject of the mail - * - * - * - * HTML メール送信に使用します。 - * - * @param delivery - メール配信に使用される ERMailDeliveryHTML - * @param pageName - HTMLメッセージを持つインスタンス化する WOComponent 名 - * @param alternatePageName - テキスト・メッセージを持つインスタンス化する WOComponent 名 - * @param emailFrom - 送信元のメール・アドレス - * @param emailTo - 送信先のメール・アドレス - * @param emailReplyTo - 返信先のメール・アドレス - * @param subject - メールのサブジェクト - * - */ - public static void sendHTMLMail(ERMailDeliveryHTML delivery, String pageName, String alternatePageName, String emailFrom, String emailTo, String emailReplyTo, String subject) { - WOComponent mailPage = ERMailUtils.instantiatePage(pageName, delivery.sessionDictionary()); - - delivery.newMail(); - delivery.setComponent(mailPage); - - if (alternatePageName != null) { - String alternateString = null; - WOComponent alternateMailTemplate = ERMailUtils.instantiatePage(alternatePageName, delivery.sessionDictionary()); - - alternateString = alternateMailTemplate.generateResponse().contentString(); - - if (alternateString != null) { - delivery.setHiddenPlainTextContent(alternateString); - alternateMailTemplate.session().terminate(); - } - } - - try { - delivery.setFromAddress(emailFrom); - delivery.setToAddress(emailTo); - delivery.setReplyToAddress(emailReplyTo); - delivery.setSubject((subject == null) ? "" : subject); - delivery.sendMail(); - } - catch (javax.mail.MessagingException e) { - // we must handle this exception correctly because the - // mail cannot be sent - log.warn("While trying to sendMail: ", e); - } - finally { - // We need to force the termination of the sessions - // because there is some sort of circular reference - // between the context and the session when it is - // instantiated from a newly created WOContext. - mailPage.session().terminate(); - } - } - - /** - * - * Use this method to send an HTML mail, but default mail delivery. - * - * @param pageName - * The name of the WOComponent that must be instantiated. - * @param alternatePageName - * The name of the WOComponent that represents for the text that must be displayed when an alternate - * plain text version of the mail needs to be provided. - * @param emailFrom - * the email address the mail is sent from - * @param emailTo - * the email address the mail is sent to - * @param emailReplyTo - * the email address where the mail must be replied-to. - * @param subject - * the subject of the mail - * - * - * - * デフォルト配信インスタンスを使用し、 HTML メール送信を行います。 - * - * @param pageName - HTMLメッセージを持つインスタンス化する WOComponent 名 - * @param alternatePageName - テキスト・メッセージを持つインスタンス化する WOComponent 名 - * @param emailFrom - 送信元のメール・アドレス - * @param emailTo - 送信先のメール・アドレス - * @param emailReplyTo - 返信先のメール・アドレス - * @param subject - メールのサブジェクト - * - */ - public static void sendHTMLMail(String pageName, String alternatePageName, String emailFrom, String emailTo, String emailReplyTo, String subject) { - sendHTMLMail(sharedDeliverer(), pageName, alternatePageName, emailFrom, emailTo, emailReplyTo, subject); - } - - /** - * - * This method sets the values found in a dictionary into the session's state dictionary. This method is useful when - * one want to transfer current session's state into a newly created session (for example when sending a mail whose - * page has been instantiated with {@link #instantiatePage(String, NSDictionary)} or - * {@link er.extensions.appserver.ERXApplication#instantiatePage(String)}.) - * - * @param dict - * a NSDictionary value containing the values we want to set in the session parameter. - * @param session - * a WOSession value that will receive the values contained in the dict parameter. - * - * - * - * このメソッドはディクショナリー内で見つかる値をセッション状態ディクショナリーにセットします。 - * このメソッドはカレント・セッションを新セッションに移行する時に有効です。 - * (たとえば、{@link #instantiatePage(String, NSDictionary)} や {@link er.extensions.appserver.ERXApplication#instantiatePage(String)} - * でインスタンス化されているページを送信する場合に有効です。) - * - * @param dict - セッションに設定する情報を持つ NSDictionary - * @param session - ディクショナリー内に設定されている値をセットする WOSession - * - */ - public static void setDictionaryValuesInSession(NSDictionary dict, WOSession session) { - if ((dict == null) || (session == null)) { - return; - } - - Enumeration en = dict.keyEnumerator(); - while (en.hasMoreElements()) { - String key = (String) en.nextElement(); - Object object = dict.objectForKey(key); - if (object != null) { - if (log.isDebugEnabled()) { - log.debug("Setting in session dict value '" + object.toString() + "' for key '" + key + "'"); - } - - session.setObjectForKey(object, key); - } - } - } - - /** エンコーディング処理 */ - public static String encodeString(String string, String charset) { - String encodedString = null; - - try { - encodedString = MimeUtility.encodeText(string, charset, !charset.equals(ERMailDelivery.DefaultCharset) ? "B" : null); - } - catch (Exception e) { - encodedString = string; - } - - return encodedString; - } - - /** - * - * Method that converts NSArray of String emails to InternetAddress []. - * - * @param addrs - * a NSArray value - * @return an InternetAddress[] value - * @exception AddressException - * if an error occurs - * - * - * - * String メールの NSArray を InternetAddress [] へ変換します。 - * - * @param addrs - NSArray - * - * @return InternetAddress[] - * - * @exception AddressException - エラー発生した場合 - * - */ - public static InternetAddress[] convertNSArrayToInternetAddresses(NSArray addrs) throws AddressException { - if (addrs == null) - return new InternetAddress[0]; - InternetAddress[] addrArray = new InternetAddress[addrs.count()]; - - Enumeration en = addrs.objectEnumerator(); - for (int i = 0; en.hasMoreElements(); i++) { - String anAddress = (String) en.nextElement(); - addrArray[i] = new InternetAddress(anAddress); - } - - return addrArray; - } - - /** - * - * Method that converts Address [] loaded with either Address or InternetAddress objects to NSArray of String - * emails. - *

- * Note that this method will not only accept Address [] but also InternetAddress []. - * - * @param addressesArray - * an Address[] value - * @return a NSArray value - * @exception AddressException - * if an error occurs - * - * - * - * Address [] 又は InternetAddress [] を String メールの NSArray へ変換します。 - *

- * 注意: Address [] 又は InternetAddress [] が有効です - * - * @param addressesArray - Address[] - * - * @return NSArray - * - * @exception AddressException - エラー発生した場合 - * - */ - @SuppressWarnings("unchecked") - public static NSArray convertInternetAddressesToNSArray(Address[] addressesArray) { - if (addressesArray == null) - return NSArray.EmptyArray; - NSMutableArray addresses = new NSMutableArray(addressesArray.length); - - for (int i = 0; i < addressesArray.length; i++) { - Address anAddress = addressesArray[i]; - String emailAddress = null; - - if (anAddress instanceof InternetAddress) - emailAddress = ((InternetAddress) anAddress).toUnicodeString(); - else - // anAddress will be a instance of Address - emailAddress = anAddress.toString(); - - addresses.addObject(emailAddress); - } - - return addresses; - } - - /** - * - * Method that converts NSDictionary consisting of String emails as keys and String personal names - * to InternetAddress []. - * - * @param addrs - * a NSDictionary with email, personal name as key value pair - * @param charset - * a String of the charset to use for personal string - * @return an InternetAddress[] value - * @exception AddressException - * if an error occurs - * - * - * - * String メールの NSDictionary を InternetAddress [] へ変換します。 - * キーが String メール・アドレスでオブジェクトが String の個人名 - * - * @param addrs - NSDictionary メール 個人名の KV - * @param charset - 個人名文字列に使用する文字セット - * - * @return InternetAddress[] - * - * @exception AddressException - エラー発生した場合 - * - */ - public static InternetAddress[] convertNSDictionaryToInternetAddresses(NSDictionary addrs, String charset) throws AddressException { - if (addrs == null || addrs.isEmpty()) - return new InternetAddress[0]; - InternetAddress[] addrArray = new InternetAddress[addrs.count()]; - InternetAddress address; - int i = 0; - - for (String email : addrs.allKeys()) { - String personal = addrs.objectForKey(email); - - if (personal != null && personal.length() > 0) { - address = new InternetAddress(); - address.setAddress(email); - - try { - address.setPersonal(personal, charset); - } - catch (java.io.UnsupportedEncodingException ex) { - // set the string anyway. - try { - address.setPersonal(personal); - } - catch (Exception e) { - // give up ... - } - } - } - else { - address = new InternetAddress(email); - } - addrArray[i++] = address; - } - - return addrArray; - } - - /** - * This method will parse a large string of email address that could be separated by commas, - * semicolon, tabs, spaces, carriage returns, (even mixed) and will return an NSArray of addresses(strings) - * @param str - * @return NSArray of email address - */ - public static NSArray emailsFromBulkList(String str) { - if ( (str!=null) && (str.length() > 3) ) { - //str = str.toLowerCase(); - str = str.replace("\"", ""); - str = str.replace(";", ""); - str = str.replace(":", ""); - str = str.replace("'", ""); - str = str.replace("\n", ","); - str = str.replace("\r", ","); - str = str.replace(" ", ","); - str = str.replace("\t", ","); - str = str.replaceAll(",+", ","); - String[] tokens = str.split(","); - return new NSArray(tokens); - } - return null; - } - -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMessage.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMessage.java deleted file mode 100644 index 45d576a636c..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMessage.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - ERMessage.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import javax.mail.Address; -import javax.mail.Flags; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.internet.AddressException; -import javax.mail.internet.MimeMessage; - -import com.webobjects.foundation.NSArray; -import com.webobjects.foundation.NSDictionary; - -/** - * - * ERMessage represents an email message. - * - * - * - * ERMessage はメール・メッセージを表現します - * - */ -public class ERMessage { - /** - * - * Defines a delegate interface for receiving notifications - * about email messages. - * - * - * - * メール・メッセージについての通知を受信するデリゲート・インタフェースを定義します。 - * - * - * @author mschrag - */ - public static interface Delegate { - /** - * - * Called when a message is successfully delivered. - * - * @param message the message that was delivered - * - * - * - * メッセージ送信が成功した場合 - * - * @param message - 成功したメッセージ - * - */ - public void deliverySucceeded(ERMessage message); - - /** - * - * Called when a message fails with invalid recipients. You will get - * a call to invalidRecipients AND a call to deliveryFailed. - * - * @param message the message that was not delivered - * @param invalidRecipientAddresses the array of invalid email addresses - * - * - * - * メッセージが送信先などで失敗したい場合 - * invalidRecipients と deliveryFailed にコールが行きます。 - * - * @param message - 送信できなかったしたメッセージ - * @param invalidRecipientAddresses - 失敗したメール・アドレス配列 - * - */ - public void invalidRecipients(ERMessage message, NSArray invalidRecipientAddresses); - - /** - * - * Called when a message fails to deliver. - * - * @param message the message that failed - * @param failure the exception of the failure - * - * - * - * メッセージ送信が失敗した場合 - * - * @param message - 失敗したメッセージ - * @param failure - 失敗した原因 - * - */ - public void deliveryFailed(ERMessage message, Throwable failure); - } - - private ERMessage.Delegate _delegate; - private MimeMessage _message; - private NSDictionary _userInfo; - private String _contextString; - - public void setDelegate(ERMessage.Delegate delegate) { - _delegate = delegate; - } - - public void setUserInfo(NSDictionary userInfo) { - _userInfo = userInfo; - } - - public NSDictionary userInfo() { - return _userInfo; - } - - public void setContextString(String contextString) { - _contextString = contextString; - } - - public String contextString() { - return _contextString; - } - - public void setMimeMessage(MimeMessage m) { - _message = m; - } - - public MimeMessage mimeMessage() { - return _message; - } - - public boolean shouldSendMessage() { - Address to[] = null; - try { - to = _message.getRecipients(Message.RecipientType.TO); - } - catch (MessagingException m) { - } - return to != null && to.length > 0; - } - - /** - * - * @param recipientType - * which can be: Message.RecipientType.To, Message.RecipientType.CC, or - * Message.RecipientType.BCC - * - * - * - * @param recipientType - * Message.RecipientType.ToMessage.RecipientType.CC 又は - * Message.RecipientType.BCC の中の一つ - * - */ - public Address[] recipients(Message.RecipientType recipientType) throws MessagingException { - return _message == null ? null : _message.getRecipients(recipientType); - } - - public String recipientsAsString(Message.RecipientType recipientType) throws MessagingException, AddressException { - return recipientsAsString(recipientType, -1); - } - - public String recipientsAsString(Message.RecipientType recipientType, int maxAddresses) throws MessagingException, AddressException { - Address[] allAddresses = recipients(recipientType); - Address[] limitteredAddresses = null; - - if (allAddresses == null || allAddresses.length == 0) - return null; - - if (maxAddresses > 0) { - limitteredAddresses = new Address[maxAddresses]; - System.arraycopy(allAddresses, 0, limitteredAddresses, 0, Math.min(allAddresses.length, maxAddresses)); - } - else { - limitteredAddresses = allAddresses; - } - - StringBuilder result = new StringBuilder(); - result.append(ERMailUtils.convertInternetAddressesToNSArray(limitteredAddresses).componentsJoinedByString(", ")); - if (0 < maxAddresses && maxAddresses < allAddresses.length) { - result.append(", and "); - result.append(allAddresses.length - maxAddresses); - result.append(" other recipients"); - } - return result.toString(); - } - - public String allRecipientsAsString() throws MessagingException { - return allRecipientsAsString(true, -1); - } - - public String allRecipientsAsString(boolean includeBcc) throws MessagingException { - return allRecipientsAsString(includeBcc, -1); - } - - public String allRecipientsAsString(boolean includeBcc, int maxAddresses) throws MessagingException { - StringBuilder recipients = new StringBuilder(); - String addresses = recipientsAsString(Message.RecipientType.TO, maxAddresses); - if (addresses != null && addresses.length() > 0) - recipients.append("To: ").append(addresses); - - addresses = recipientsAsString(Message.RecipientType.CC, maxAddresses); - if (addresses != null && addresses.length() > 0) - recipients.append("CC: ").append(addresses); - - if (includeBcc) { - addresses = recipientsAsString(Message.RecipientType.BCC, maxAddresses); - if (addresses != null && addresses.length() > 0) - recipients.append("BCC: ").append(addresses); - } - return recipients.toString(); - } - - @Override - public String toString() { - StringBuilder sbuf = new StringBuilder(); - sbuf.append('<').append(getClass().getName()).append(' '); - if (_message == null) { - sbuf.append("No mime message is set."); - } - else { - try { - sbuf.append(allRecipientsAsString()); - } - catch (MessagingException ex) { - // do nothing - } - } - sbuf.append('>'); - return sbuf.toString(); - } - - /** - * Called by ERMailSender - */ - public void _deliverySucceeded() { - if (_delegate != null) { - _delegate.deliverySucceeded(this); - } - } - - /** - * Called by ERMailSender - */ - public void _invalidRecipients(NSArray invalidRecipientAddresses) { - if (_delegate != null) { - _delegate.invalidRecipients(this, invalidRecipientAddresses); - } - } - - /** - * Called by ERMailSender - */ - public void _deliveryFailed(Throwable failure) { - if (_delegate != null) { - _delegate.deliveryFailed(this, failure); - } - } - - /* - * Set the DELETED flag on the message, so that you can expunge it when you close a IMAP folder. - */ - public void setDeleteFlag() throws MessagingException { - mimeMessage().setFlag(Flags.Flag.DELETED,true); - } -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMimetypesMapper.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMimetypesMapper.java deleted file mode 100644 index 4b99021caec..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERMimetypesMapper.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - ERMimetypesMapper.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import java.io.InputStream; - -import javax.activation.MimetypesFileTypeMap; - -import com.webobjects.appserver.WOApplication; -import com.webobjects.appserver.WOResourceManager; - -public class ERMimetypesMapper { - private static MimetypesFileTypeMap mimetypesMapper = null; - - protected static MimetypesFileTypeMap mapper() { - if (mimetypesMapper == null) { - WOResourceManager resourceManager = WOApplication.application().resourceManager(); - InputStream is = resourceManager.inputStreamForResourceNamed("mime.types", "ERJavaMail", null); - - mimetypesMapper = new MimetypesFileTypeMap(is); - is = null; - } - - return mimetypesMapper; - } - - /** - * - * Mimetype オブジェクトへアクセスします。ファイルへのパスを引数として渡すと Mime が戻ります。 - * - * @param path - ファイルへのパス - * - * @return Mimetype を持つ文字列 - * - * サンプル - * - * String s = ERMimetypesMapper.mimeContentTypeForPath( ERXFileUtilities.pathForResourceNamed("test.gif", "ERExtensions", null) ); - * - */ - public static String mimeContentTypeForPath(String path) { - return ERMimetypesMapper.mapper().getContentType(path); - } - -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERQueue.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERQueue.java deleted file mode 100644 index ad1e7ec45e9..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERQueue.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - ERQueue.java - Camille Troillard - tuscland@mac.com - */ - -package er.javamail; - -import java.util.Vector; - -public class ERQueue extends Vector { - /** - * Do I need to update serialVersionUID? - * See section 5.6 Type Changes Affecting Serialization on page 51 of the - * Java Object Serialization Spec - */ - private static final long serialVersionUID = 1L; - - protected int _maxSize = 0; - - /** - * - * キューの最大サイズを戻します。 - * - * @return キューの最大サイズ - * - */ - public int maxSize() { - return _maxSize; - } - - /** - * - * キューの最大サイズをセットします - * - * @param size - キューの最大サイズ - * - */ - public void setMaxSize(int size) { - _maxSize = size; - } - - public static class SizeOverflowException extends Exception { - /** - * Do I need to update serialVersionUID? - * See section 5.6 Type Changes Affecting Serialization on page 51 of the - * Java Object Serialization Spec - */ - private static final long serialVersionUID = 1L; - - public SizeOverflowException() { - super(); - } - } - - public ERQueue() { - this(0); - } - - public ERQueue(int maxSize) { - super(); - _maxSize = maxSize; - } - - /** - * - * 新しいアイテムをキューに登録します。 - * - * @param item - アイテム - * - * @return 登録されたアイテム - * - * @throws SizeOverflowException - * - */ - public T push(T item) throws SizeOverflowException { - if ((_maxSize == 0) || (size() < _maxSize)) { - addElement(item); - } - else { - throw new SizeOverflowException(); - } - return item; - } - - /** - * - * 一番最初にキューに入ったアイテムをポップし、戻します。 - * - * @return 一番最初にキューに入ったアイテム - * - */ - public synchronized T pop() { - T element = elementAt(0); - removeElementAt(0); - return element; - } - - /** - * - * 一番最初にキューに入ったアイテムを消さすに戻します。 - * - * @return 一番最初にキューに入ったアイテム - * - */ - public synchronized T peek() { - return elementAt(0); - } - - /** - * - * キューサイズが 0 の場合 - * - * @return キューのサイズが 0 の場合には true が戻ります。 - * - */ - public boolean empty() { - return size() == 0; - } - - /** - * - * キュー内のオブジェクトを探して、インデックスを戻します。 - * - * @param o - 検索するオブジェクト - * - * @return インデックス番号 - * - */ - public synchronized int search(Object o) { - return indexOf(o); - } -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERWOMailDelivery.java b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERWOMailDelivery.java deleted file mode 100644 index d8f95d5788e..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/ERWOMailDelivery.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - Copyright (c) 2002 Red Shed Software. All rights reserved. - by Jonathan 'Wolf' Rentzsch (jon at redshed dot net) - */ - -package er.javamail; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.util.Enumeration; - -import javax.activation.DataHandler; -import javax.mail.Message; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; - -import org.apache.log4j.Logger; - -import com.webobjects.appserver.WOApplication; -import com.webobjects.appserver.WOComponent; -import com.webobjects.appserver.WOSession; -import com.webobjects.foundation.NSArray; - -/** - * - * Drop-in replacement for WOMailDelivery. - * - *

- * ERWOMailDelivery operates just the same as WOMailDelivery, and has all of the same limitations and weird API. - * However, instead of using the Sun's broken* and unsupported sun.net.smtp.SmtpClient, it uses JavaMail. - *

- * - *

- * *sun.net.smtp.SmtpClient doesn't put addresses in angle brackets when sending the SMTP MAIL FROM command. Many - * SMTP servers won't work with it. - *

- *
- * - * - * WOMailDelivery の替わりに使用します。 - * - *

- * ERWOMailDelivery は WOMailDelivery と同じように動作します。全く同じ制限と不思議な API を持っています。 - * 正しい、Sun 社の壊れているサポートしない sun.net.smtp.SmtpClient と違って JavaMail を使用しています。 - *

- * - *

- * *sun.net.smtp.SmtpClient は SMTP MAIL FROM で送信するアドレスを括弧で囲まないので、大抵の SMTP サーバは動作しないのです。 - *

- *
- * - * @author Jonathan 'Wolf' Rentzsch (jon at redshed dot net) - * @see com.webobjects.appserver.WOMailDelivery - */ - -public class ERWOMailDelivery { - /** - * - * @return The shared instance. - * - * - * - * @return 共有インスタンス - * - */ - public static ERWOMailDelivery sharedInstance() { - if (_sharedInstance == null) - _sharedInstance = new ERWOMailDelivery(); - return _sharedInstance; - } - - /** - * Default constructor (don't use). Use {@link #sharedInstance()} instead. - * 未使用のコンストラクタ: {@link #sharedInstance()} を使用します。 - */ - protected ERWOMailDelivery() { - // Just here & protected so folks don't try to construct directly. - } - - /** - * - * Creates and optionally sends a plain text email. - * - * @param fromEmailAddress - * Originating email address. Required. - * @param toEmailAddresses - * Destination email address. Required. - * @param bccEmailAddresses - * Array of Strings containing additional addressed to BCC. Can be null. - * @param subject - * Subject the message. Can be null. - * @param message - * Body the the message. Required. - * @param sendNow - * Whether to send the message right away. If you're going to send the message right away, it's faster to - * set sendNow to true than set it to false and calling {@link #sendEmail(String)} later. - * - * - * - * 標準テキスト・メールを作成と送信します。 - * - * @param fromEmailAddress - 送信元メール・アドレス(必須) - * @param toEmailAddresses - 送信先メール・アドレス NSArray(必須) - * @param bccEmailAddresses - BCC メール・アドレス NSArray (Null可) - * @param subject - メール・サブジェクト(Null可) - * @param message - メッセージ(必須) - * @param sendNow - true ですぐに送信します。 - * すぐに送信時には false を設定し後で {@link #sendEmail(String)} で送信するよりも true の方が早い - * - */ - public String composePlainTextEmail(String fromEmailAddress, NSArray toEmailAddresses, NSArray bccEmailAddresses, String subject, String message, boolean sendNow) { - // /JAssert.notEmpty( fromEmailAddress ); - // /JAssert.notNull( toEmailAddresses ); - // /JAssert.greaterThan( toEmailAddresses.count(), 0 ); - // /JAssert.notEmpty( message ); - - // /JAssert.notNull( ERJavaMail.sharedInstance().defaultSession() ); - - MimeMessage smtpMessage = newMimeMessage(fromEmailAddress, toEmailAddresses, bccEmailAddresses, subject, message, "text/plain", sendNow); - - return mimeMessageToString(smtpMessage); - } - - /** - * - * Creates and optionally sends a WOComponent as email. - * - * @param fromEmailAddress - * Originating email address. Required. - * @param toEmailAddresses - * Destination email address. Required. - * @param bccEmailAddresses - * Array of Strings containing additional addressed to BCC. Null OK. - * @param subject - * Subject the the message. Null OK. - * @param component - * Body the the message. Required. - * @param sendNow - * Whether to send the message right away. If you're going to send the message right away, it's faster to - * set sendNow to true than set it to false and calling {@link #sendEmail(String)} later. - * - * - * - * WOComponent メールを作成と送信します。 - * - * @param fromEmailAddress - 送信元メール・アドレス(必須) - * @param toEmailAddresses - 送信先メール・アドレス NSArray(必須) - * @param bccEmailAddresses - BCC メール・アドレス NSArray (Null可) - * @param subject - メール・サブジェクト(Null可) - * @param component - コンポーネント(必須) - * @param sendNow - true ですぐに送信します。 - * すぐに送信時には false を設定し後で {@link #sendEmail(String)} で送信するよりも true の方が早い - * - */ - public String composeComponentEmail(String fromEmailAddress, NSArray toEmailAddresses, NSArray bccEmailAddresses, String subject, WOComponent component, boolean sendNow) { - // XXX the component parameter above was 'message'. the real parameter could be renamed. - // /JAssert.notEmpty( fromEmailAddress ); - // /JAssert.notNull( toEmailAddresses ); - // /JAssert.greaterThan( toEmailAddresses.count(), 0 ); - // /JAssert.notNull( component ); - // /JAssert.notNull( component.context() ); - - // /JAssert.notNull( ERJavaMail.sharedInstance().defaultSession() ); - - WOSession session = component.context()._session(); - String response; - - component.context().generateCompleteURLs(); - if (session == null) { - response = component.generateResponse().contentString(); - } - else { - boolean oldStoresIDsInURLs = session.storesIDsInURLs(); - session.setStoresIDsInURLs(true); - response = component.generateResponse().contentString(); - session.setStoresIDsInURLs(oldStoresIDsInURLs); - } - component.context().generateRelativeURLs(); - - // -- - - MimeMessage smtpMessage = newMimeMessage(fromEmailAddress, toEmailAddresses, bccEmailAddresses, subject, response, "text/html", sendNow); - - return mimeMessageToString(smtpMessage); - } - - /** - * - * Sends the RFC822 mail string created with either - * {@link #composePlainTextEmail(String,NSArray,NSArray,String,String,boolean)} or - * {@link #composeComponentEmail(String,NSArray,NSArray,String,WOComponent,boolean)}. It's faster to call either - * method with the sendNow parameter set to true than to use this method. - * - * - * "; - } - - // Private Implementation. - private static Logger log = Logger.getLogger(ERWOMailDelivery.class); - private static ERWOMailDelivery _sharedInstance = null; - - private MimeMessage newMimeMessage(String fromEmailAddress, NSArray toEmailAddresses, NSArray bccEmailAddresses, String subject, String message, String contentType, boolean sendNow) { - // /JAssert.notEmpty( fromEmailAddress ); - // /JAssert.notNull( toEmailAddresses ); - // /JAssert.greaterThan( toEmailAddresses.count(), 0 ); - // /JAssert.notEmpty( message ); - // /JAssert.notEmpty( contentType ); - - // /JAssert.notNull( ERJavaMail.sharedInstance().defaultSession() ); - - MimeMessage smtpMessage = null; - - try { - smtpMessage = new MimeMessage(ERJavaMail.sharedInstance().defaultSession()); - smtpMessage.setFrom(new InternetAddress(fromEmailAddress)); - - Enumeration addressEnumerator = toEmailAddresses.objectEnumerator(); - while (addressEnumerator.hasMoreElements()) { - String address = addressEnumerator.nextElement(); - smtpMessage.addRecipient(Message.RecipientType.TO, new InternetAddress(address)); - } - - if (bccEmailAddresses != null && bccEmailAddresses.count() > 0) { - addressEnumerator = bccEmailAddresses.objectEnumerator(); - while (addressEnumerator.hasMoreElements()) { - String address = addressEnumerator.nextElement(); - smtpMessage.addRecipient(Message.RecipientType.BCC, new InternetAddress(address)); - } - } - - smtpMessage.setSubject(subject); - smtpMessage.setContent(message, contentType); - - if (sendNow) - (new MimeMessageMailDelivery(smtpMessage)).sendMail(); - } - catch (Exception x) { - log.error(x); - } - - return smtpMessage; - } - - private static String mimeMessageToString(MimeMessage smtpMessage) { - // /JAssert.notNull( smtpMessage ); - - String result = null; - - try { - ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); - smtpMessage.writeTo(baos); - result = baos.toString(); - } - catch (Exception x) { - log.error(x); - } - - return result; - } - - private static class MimeMessageMailDelivery extends ERMailDelivery { - public MimeMessageMailDelivery(MimeMessage msg) { - super(); - setMimeMessage(msg); - } - - @Override - protected DataHandler prepareMail() { - MimeMessage msg = mimeMessage(); - String contentType = "text/plain"; - - try { - contentType = msg.getContentType(); - } - catch (javax.mail.MessagingException x) { - ERWOMailDelivery.log.error(x); - } - - return new DataHandler(ERWOMailDelivery.mimeMessageToString(msg), contentType); - } - } -} diff --git a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/package.html b/Frameworks/Mail/ERJavaMail/Sources/er/javamail/package.html deleted file mode 100644 index 25d772f2aef..00000000000 --- a/Frameworks/Mail/ERJavaMail/Sources/er/javamail/package.html +++ /dev/null @@ -1,267 +0,0 @@ - - - Odaiko MailDelivery Framework - - - -

IMPORTANT NOTICE

- -

-These files are protected under the GNU Lesser Public License. -You should read and understand the terms of this license before using it. -The article 15 in the LICENSE read this: -

- -

-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE
-LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
-AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY 
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT 
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 
-FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND 
-PERFORMANCE OF THE LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE 
-DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR 
-OR CORRECTION.
-

- - -

WHAT CAN I DO WITH IT ?

- -

-This small framework is intended to send mails with the JavaMail API in conjunction to Apple WebObjects (http://www.apple.com/webobjects). You can also use it without WebObjects but some (very little) porting is needed. Two classes can't be used in this context: ERMailDeliveryWOComponentPlainText and ERMailDeliveryHTML. -

- -

ADVANTAGES

- -

-This framework merely consists of 5 files that you may add to your project or compile as a separate framework. Its originality comes from its ability to send mail with a separated thread. Most of JavaMail functionalities are not hidden so it's easy to write subclasses that extend the use of these classes. -

-When you need to send multiple mails you don't create multiple instances of ERMailDelivery subclasses, you just create one instance and call the newMail () method to create a new message, this is useful for memory / performances issues. -

-I created these classes because there was a bug in WOMailDelivery in deployment mode that I cannot solve. The other advantage is that the mails are sent within the process and JVM of the currently running application. -

- - -

CONFIGURATION

- -

-Copy and customize the properties given in SampleConfiguration.txt under 'Support' group in the project files. -

- -
-
er.javamail.centralize = true
-
Centralize sends all emails to the er.javamail.adminEmail user.
- -
er.javamail.debugEnabled = true
-
Determines whether or not email debugging is displayed. This contains protocol-level debug information.
- -
er.javamail.adminEmail = user@domain.com
-
The email address of the admin user to send centralized emails to. This is a required property.
- -
er.javamail.smtpHost = smtp.domain.com
-
The SMTP host name to use. If this isn't set, mail.smtp.host will be checked and ultimately WOHost will be used.
- -
er.javamail.senderQueue.size = 50
-
The number of messages that the sender queue can hold. Defaults to 50.
- -
er.javamail.milliSecondsWaitIfSenderOverflowed = 6000
-
The number of milliseconds to wait if the sender queue is full. Default is 6000.
- -
er.javamail.smtpAuth = true
-
Sets whether or not Authenticated SMTP is used to send outgoing mail. If set, er.javamail.smtpUser MUST -also be set (and preferably er.javamail.smtpPassword).
- -
er.javamail.smtpUser = smtpusername
-
The username to use to login to the authenticated SMTP server.
- -
er.javamail.smtpPassword = smtppassword
-
The password to use to login to the authenticated SMTP server.
- -
er.javamail.XMailerHeader =
-
The X-Mailer header to put into all outgoing mail messages. Defaults to nothing.
- -
er.javamail.defaultEncoding = UTF-8
-
The default character encoding to use for message content. Defaults to ???.
- -
er.javamail.WhiteListEmailAddressPatterns =
-
A comma-separated list of whitelisted email address patterns. If set, then only addresses that match one of the whitelisted -patterns will delivered to. Pattern syntax is the same as EOQualifier's caseInsensitiveLike.
- -
er.javamail.BlackListEmailAddressPatterns =
-
A comma-separated list of blacklisted email address patterns. If set, then any email addresses that match a blacklist pattern -will not be delivered to. Pattern syntax is the same as EOQualifier's caseInsensitiveLike. The blacklist filter is processed -last, so a blacklist pattern beats a whitelist pattern.
-
- -

CODE SAMPLE

- -
-// Create an instance of an ERMailDelivery subclass
-ERMailDeliveryHTML mail = new ERMailDeliveryHTML ();
-
-// Here ERMailDeliveryHTML needs a WOComponent to render the HTML text content.
-mail.setComponent(mailPage);
-
-// Here you create a new instance of the message
-// You can loop over this fragment of code, not forgetting to use newMail ()
-// before you set the attributes of the message.
-try {
-    mail.newMail();
-    mail.setFromAddress(emailFrom);
-    mail.setReplyToAddress(emailReplyTo);
-    mail.setSubject(emailSubject);
-    mail.setToAddresses(new NSArray (toEmailAddresses));
-    // Send the mail.  There is an optional sendMail(boolean) that optionally blocks during the send.
-    mail.sendMail();
-} catch (Exception e) {
-    // handle the exception ...
-}
-
- -

GOTCHAS

- -

-Be careful of the WOContext that contains the component you are sending. If you use -ERMailDeliveryHTML inside of the normal request-response loop with the default WOContext, -it is very likely that the next page that is sent to the user will be the emailed component -rather than the page you WANTED to send. There are several possible workarounds for this. -One is to return a specific component rather than null from your action method. I have -had better and more consistent success with the following code: -

- -

-WOContext context = (WOContext) context().clone();
-MyComponent component = (MyComponent) WOApplication.application().pageWithName(MyComponent.class.getName(), context);
-ERMailDeliveryHTML mail = new ERMailDeliveryHTML();
-mail.setComponent(component);
-...
-

- -

-This seems to properly isolate the email to a clone of the current context rather than the -actual active context. Your mileage may vary :) -

- -

CHANGES

- -
-06/29/2005:
-    Added support for authenticated SMTP and updated the documentation.
-    
-10/09/2002:
-    Made API more consistent with Project Wonder.
-
-09/19/2001:
-    Packaged the framework into a WebObjects 5 framework.
-    As long as ProjectBuilder for Mac OX X and ProjectBuilder for Windows are incompatible,
-    the project can't be used under Windows, unless it is compiled under another platform.
-
-    OFMaildelivery.setToAddress now takes an NSArray as argument. java.util.Vector is no
-    longer used.
-
- - -

FEEDBACK

- -

-Don't hesitate to send {postcards, feedback, love letters} to Camille Troillard <tuscland@mac.com> -

- - - diff --git a/Frameworks/Mail/ERJavaMail/Tests/er/javamail/ERMailSenderTest.java b/Frameworks/Mail/ERJavaMail/Tests/er/javamail/ERMailSenderTest.java deleted file mode 100644 index 5304b640cf6..00000000000 --- a/Frameworks/Mail/ERJavaMail/Tests/er/javamail/ERMailSenderTest.java +++ /dev/null @@ -1,187 +0,0 @@ -package er.javamail; - -import java.util.LinkedList; -import java.util.List; - -import javax.mail.Address; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.URLName; -import javax.mail.internet.AddressException; - -import junit.framework.TestCase; -import er.extensions.foundation.ERXProperties; - -public class ERMailSenderTest extends TestCase { - public List relays() { - List relays = new LinkedList(); - relays.add(new RelayInfo(null, "mail.pobox.com", "mschrag@pobox.com", "mschrag@pobox.com")); - relays.add(new RelayInfo("other", "mailother.pobox.com", "mschrag@pobox.com", "mschrag@pobox.com")); - return relays; - } - - public RelayInfo defaultRelay() { - return relays().get(0); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - for (RelayInfo relay : relays()) { - if (relay.contextString == null) { - System.setProperty("er.javamail.smtpHost", relay.host); - } else { - System.setProperty("er.javamail.smtpHost." + relay.contextString, relay.host); - } - } - ERXProperties.setStringForKey("smtptest", "mail.smtp.protocol"); - ERJavaMail.sharedInstance().finishInitialization(); - TestSMTPTransport.clearSentMessages(); - } - - protected void sendTestMessage(RelayInfo relay, boolean sendNow) throws AddressException, MessagingException { - ERMailDeliveryPlainText mailDelivery = new ERMailDeliveryPlainText(); - mailDelivery.setSubject("Test Subject"); - mailDelivery.setToAddress(relay.fromAddress); - mailDelivery.setFromAddress(relay.toAddress); - mailDelivery.setTextContent("Test Message"); - mailDelivery.setContextString(relay.contextString); - mailDelivery.sendMail(sendNow); - } - - protected void testSendMessageNowWithRelay(RelayInfo relay) throws MessagingException { - sendTestMessage(relay, true); - - List sentMessages = TestSMTPTransport.sentMessages(); - assertEquals(1, sentMessages.size()); - assertEquals(relay.host, sentMessages.get(0).transport.getSession().getProperty("mail.smtptest.host")); - } - - public void testSendMessageNowDefaultRelay() throws MessagingException { - testSendMessageNowWithRelay(defaultRelay()); - } - - public void testSendMessageNowOtherRelay() throws MessagingException { - testSendMessageNowWithRelay(relays().get(1)); - } - - protected void waitForMessages(int count) { - for (long startTime = System.currentTimeMillis(); TestSMTPTransport.sentMessages().size() < count && System.currentTimeMillis() - startTime < 10000;) { - // DO NOTHING - } - } - - protected void testSendMessageDeferredWithRelay(RelayInfo relay) throws MessagingException { - sendTestMessage(relay, false); - - waitForMessages(1); - - List sentMessages = TestSMTPTransport.sentMessages(); - assertEquals(1, sentMessages.size()); - assertEquals(relay.host, sentMessages.get(0).transport.getSession().getProperty("mail.smtptest.host")); - } - - public void testSendMessageDeferredDefaultRelay() throws MessagingException { - testSendMessageDeferredWithRelay(defaultRelay()); - } - - public void testSendMessageDeferredOtherRelay() throws MessagingException { - testSendMessageDeferredWithRelay(relays().get(1)); - } - - public void testSendTwoMessagesDeferredMixedRelays() throws AddressException, MessagingException { - sendTestMessage(relays().get(0), false); - sendTestMessage(relays().get(1), false); - - waitForMessages(2); - - List sentMessages = TestSMTPTransport.sentMessages(); - assertEquals(2, sentMessages.size()); - assertEquals(relays().get(0).host, sentMessages.get(0).transport.getSession().getProperty("mail.smtptest.host")); - assertEquals(relays().get(1).host, sentMessages.get(1).transport.getSession().getProperty("mail.smtptest.host")); - } - - public static class SentMessage { - public TestSMTPTransport transport; - - public Message message; - - public Address[] addresses; - - public SentMessage(TestSMTPTransport transport, Message message, Address[] addresses) { - this.transport = transport; - this.message = message; - this.addresses = addresses; - } - } - - public static class TestSMTPTransport extends Transport { - private static List _sentMessages = new LinkedList(); - - public TestSMTPTransport(Session session, URLName urlname) { - super(session, urlname); - } - - public Session getSession() { - return session; - } - - @Override - public void sendMessage(Message message, Address[] addresses) throws MessagingException { - synchronized (_sentMessages) { - _sentMessages.add(new SentMessage(this, message, addresses)); - } - } - - @Override - public void connect() throws MessagingException { - // DO NOTHING - } - - @Override - public void connect(String host, int port, String user, String password) throws MessagingException { - // DO NOTHING - } - - @Override - public void connect(String user, String password) throws MessagingException { - // DO NOTHING - } - - @Override - public void connect(String host, String user, String password) throws MessagingException { - // DO NOTHING - } - - public static void clearSentMessages() { - synchronized (_sentMessages) { - _sentMessages.clear(); - } - } - - public static List sentMessages() { - synchronized (_sentMessages) { - return new LinkedList(_sentMessages); - } - } - } - - public static class RelayInfo { - public String contextString; - - public String host; - - public String fromAddress; - - public String toAddress; - - public RelayInfo(String contextString, String host, String fromAddress, String toAddress) { - this.contextString = contextString; - this.host = host; - this.fromAddress = fromAddress; - this.toAddress = toAddress; - } - } -} diff --git a/Frameworks/Mail/ERJavaMail/WebServerResources/dummyfile.txt b/Frameworks/Mail/ERJavaMail/WebServerResources/dummyfile.txt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/Frameworks/Mail/ERJavaMail/build.properties b/Frameworks/Mail/ERJavaMail/build.properties deleted file mode 100644 index f88aab8b022..00000000000 --- a/Frameworks/Mail/ERJavaMail/build.properties +++ /dev/null @@ -1,14 +0,0 @@ -cfBundleID=er.javamail -cfBundleShortVersion= -cfBundleVersion= -classes.dir=bin -component.inlineBindingPrefix=$ -component.inlineBindingSuffix= -component.wellFormedTemplateRequired=false -customInfoPListContent= -eoAdaptorClassName= -project.name=ERJavaMail -project.name.lowercase=erjavamail -project.principal.class=er.javamail.ERJavaMail -principalClass=er.javamail.ERJavaMail -project.type=framework diff --git a/Frameworks/Mail/ERJavaMail/build.xml b/Frameworks/Mail/ERJavaMail/build.xml deleted file mode 120000 index 0f8b528f5ed..00000000000 --- a/Frameworks/Mail/ERJavaMail/build.xml +++ /dev/null @@ -1 +0,0 @@ -../../../Build/build/build-framework-template.xml \ No newline at end of file diff --git a/Frameworks/Mail/ERJavaMail/pom.xml b/Frameworks/Mail/ERJavaMail/pom.xml deleted file mode 100644 index 906fd708103..00000000000 --- a/Frameworks/Mail/ERJavaMail/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - 4.0.0 - - wonder.frameworks - core - 7.0.0-SNAPSHOT - - wonder.core - ERJavaMail - ERJavaMail Framework - woframework - - - Sources - - - - wonder.core - ERExtensions - - - com.webobjects - JavaFoundation - - - com.webobjects - JavaWebObjects - - - com.webobjects - JavaXML - - - com.webobjects - JavaEOControl - - - javax.activation - activation - - - com.sun.mail - javax.mail - 1.5.4 - - - com.sun.mail - dsn - 1.5.4 - true - - - wonder.javamail - mockmail - 1.0 - test - - - \ No newline at end of file diff --git a/Frameworks/Mail/ERJavaMail/woproject/classes.exclude.patternset b/Frameworks/Mail/ERJavaMail/woproject/classes.exclude.patternset deleted file mode 100644 index 56fb545fa67..00000000000 --- a/Frameworks/Mail/ERJavaMail/woproject/classes.exclude.patternset +++ /dev/null @@ -1 +0,0 @@ -build.properties diff --git a/Frameworks/Mail/ERJavaMail/woproject/classes.include.patternset b/Frameworks/Mail/ERJavaMail/woproject/classes.include.patternset deleted file mode 100644 index 3179091db39..00000000000 --- a/Frameworks/Mail/ERJavaMail/woproject/classes.include.patternset +++ /dev/null @@ -1,2 +0,0 @@ -**/*.class -*.properties diff --git a/Frameworks/Mail/ERJavaMail/woproject/resources.exclude.patternset b/Frameworks/Mail/ERJavaMail/woproject/resources.exclude.patternset deleted file mode 100644 index 822a2329d37..00000000000 --- a/Frameworks/Mail/ERJavaMail/woproject/resources.exclude.patternset +++ /dev/null @@ -1 +0,0 @@ -Resources/**/*.eomodeld~/** diff --git a/Frameworks/Mail/ERJavaMail/woproject/resources.include.patternset b/Frameworks/Mail/ERJavaMail/woproject/resources.include.patternset deleted file mode 100644 index a9125fab74a..00000000000 --- a/Frameworks/Mail/ERJavaMail/woproject/resources.include.patternset +++ /dev/null @@ -1,3 +0,0 @@ -Components/**/*.wo/**/* -Components/**/*.api -Resources/**/* diff --git a/Frameworks/Mail/ERJavaMail/woproject/wsresources.exclude.patternset b/Frameworks/Mail/ERJavaMail/woproject/wsresources.exclude.patternset deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/Frameworks/Mail/ERJavaMail/woproject/wsresources.include.patternset b/Frameworks/Mail/ERJavaMail/woproject/wsresources.include.patternset deleted file mode 100644 index 234cdc88bb7..00000000000 --- a/Frameworks/Mail/ERJavaMail/woproject/wsresources.include.patternset +++ /dev/null @@ -1 +0,0 @@ -WebServerResources/**/*