├── .idea ├── compiler.xml ├── dictionaries │ └── fish.xml ├── encodings.xml ├── libraries │ ├── Maven__ch_qos_logback_logback_classic_1_2_3.xml │ ├── Maven__ch_qos_logback_logback_core_1_2_3.xml │ ├── Maven__com_alibaba_fastjson_1_2_31.xml │ ├── Maven__com_jayway_jsonpath_json_path_2_4_0.xml │ ├── Maven__com_sun_mail_javax_mail_1_6_2.xml │ ├── Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml │ ├── Maven__javax_activation_activation_1_1.xml │ ├── Maven__javax_annotation_javax_annotation_api_1_3_2.xml │ ├── Maven__junit_junit_4_12.xml │ ├── Maven__net_bytebuddy_byte_buddy_1_9_3.xml │ ├── Maven__net_bytebuddy_byte_buddy_agent_1_9_3.xml │ ├── Maven__net_minidev_accessors_smart_1_2.xml │ ├── Maven__net_minidev_json_smart_2_3.xml │ ├── Maven__org_apache_logging_log4j_log4j_api_2_11_1.xml │ ├── Maven__org_apache_logging_log4j_log4j_to_slf4j_2_11_1.xml │ ├── Maven__org_assertj_assertj_core_3_11_1.xml │ ├── Maven__org_attoparser_attoparser_2_0_5_RELEASE.xml │ ├── Maven__org_freemarker_freemarker_2_3_28.xml │ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml │ ├── Maven__org_hamcrest_hamcrest_library_1_3.xml │ ├── Maven__org_mockito_mockito_core_2_23_0.xml │ ├── Maven__org_objenesis_objenesis_2_6.xml │ ├── Maven__org_ow2_asm_asm_5_0_4.xml │ ├── Maven__org_skyscreamer_jsonassert_1_5_0.xml │ ├── Maven__org_slf4j_jul_to_slf4j_1_7_25.xml │ ├── Maven__org_slf4j_slf4j_api_1_7_25.xml │ ├── Maven__org_springframework_boot_spring_boot_2_1_0_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_autoconfigure_2_1_0_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_2_1_0_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_freemarker_2_1_0_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_logging_2_1_0_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_mail_2_1_0_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_test_2_1_0_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_thymeleaf_2_1_0_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_test_2_1_0_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_1_0_RELEASE.xml │ ├── Maven__org_springframework_spring_aop_5_1_2_RELEASE.xml │ ├── Maven__org_springframework_spring_beans_5_1_2_RELEASE.xml │ ├── Maven__org_springframework_spring_context_5_1_2_RELEASE.xml │ ├── Maven__org_springframework_spring_context_support_5_1_2_RELEASE.xml │ ├── Maven__org_springframework_spring_core_5_1_2_RELEASE.xml │ ├── Maven__org_springframework_spring_expression_5_1_2_RELEASE.xml │ ├── Maven__org_springframework_spring_jcl_5_1_2_RELEASE.xml │ ├── Maven__org_springframework_spring_test_5_1_2_RELEASE.xml │ ├── Maven__org_thymeleaf_extras_thymeleaf_extras_java8time_3_0_1_RELEASE.xml │ ├── Maven__org_thymeleaf_thymeleaf_3_0_11_RELEASE.xml │ ├── Maven__org_thymeleaf_thymeleaf_spring5_3_0_11_RELEASE.xml │ ├── Maven__org_unbescape_unbescape_1_1_6_RELEASE.xml │ ├── Maven__org_xmlunit_xmlunit_core_2_6_2.xml │ └── Maven__org_yaml_snakeyaml_1_23.xml ├── misc.xml ├── modules.xml ├── springboot2-email.iml ├── vcs.xml └── workspace.xml ├── README.md ├── pom.xml ├── src ├── main │ ├── java │ │ └── com │ │ │ └── ligh │ │ │ ├── EmailApplication.java │ │ │ └── service │ │ │ └── MailService.java │ └── resources │ │ ├── application.properties │ │ └── templates │ │ └── templates.html └── test │ └── java │ └── com │ └── ligh │ └── test │ └── TestSpringbootEmail.java ├── target ├── classes │ ├── application.properties │ ├── com │ │ └── ligh │ │ │ ├── EmailApplication.class │ │ │ └── service │ │ │ └── MailService.class │ └── templates │ │ └── templates.html └── test-classes │ └── com │ └── ligh │ └── test │ └── TestSpringbootEmail.class └── 笔记.txt /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/dictionaries/fish.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_fastjson_1_2_31.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_sun_mail_javax_mail_1_6_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_activation_activation_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_annotation_javax_annotation_api_1_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__junit_junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_bytebuddy_byte_buddy_1_9_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_bytebuddy_byte_buddy_agent_1_9_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_accessors_smart_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_json_smart_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_11_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_logging_log4j_log4j_to_slf4j_2_11_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_assertj_assertj_core_3_11_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_attoparser_attoparser_2_0_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_freemarker_freemarker_2_3_28.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mockito_mockito_core_2_23_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_objenesis_objenesis_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_ow2_asm_asm_5_0_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_skyscreamer_jsonassert_1_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_2_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_2_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_2_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_freemarker_2_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_2_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_mail_2_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_2_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_thymeleaf_2_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_test_2_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_2_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_aop_5_1_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_beans_5_1_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_5_1_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_support_5_1_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_core_5_1_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_expression_5_1_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_jcl_5_1_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_test_5_1_2_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_thymeleaf_extras_thymeleaf_extras_java8time_3_0_1_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_thymeleaf_thymeleaf_3_0_11_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_thymeleaf_thymeleaf_spring5_3_0_11_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_unbescape_unbescape_1_1_6_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_xmlunit_xmlunit_core_2_6_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_yaml_snakeyaml_1_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/springboot2-email.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 112 | 113 | 115 | 116 | 119 | 120 | 121 | 134 | 135 | 136 | 137 | 138 | true 139 | DEFINITION_ORDER 140 | 141 | 142 | 148 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 736 | 737 | 738 | 739 | 745 | 746 | 747 | 759 | 760 | 761 | 762 | 765 | 766 | 767 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 790 | 791 | 792 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 815 | 816 | 817 | 831 | 832 | 833 | 834 | 835 | 836 | 837 | 840 | 841 | 842 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 865 | 866 | 867 | 881 | 882 | 883 | 884 | 885 | 886 | 887 | 901 | 902 | 903 | 904 | 905 | 911 | 912 | 913 | 917 | 918 | 919 | 920 | 938 | 944 | 945 | 946 | 950 | 951 | 952 | 953 | 954 | 955 | 956 | 957 | 958 | 959 | 960 | 961 | 962 | 963 | 964 | 965 | 966 | 967 | 968 | 969 | 972 | 973 | 974 | 976 | 977 | $USER_HOME$/.subversion 978 | 979 | 980 | 981 | 982 | 1544077047994 983 | 991 | 992 | 993 | 994 | 995 | 996 | 997 | 998 | 999 | 1000 | 1001 | 1002 | 1003 | 1004 | 1005 | 1006 | 1007 | 1008 | 1009 | 1010 | 1011 | 1012 | 1013 | 1014 | 1015 | 1016 | 1017 | 1018 | 1019 | 1020 | 1021 | 1022 | 1023 | 1024 | 1025 | 1026 | 1028 | 1029 | 1030 | 1031 | 1032 | 1033 | 1034 | 1035 | 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | 1042 | 1043 | 1044 | 1045 | 1046 | 1047 | 1048 | 1049 | 1050 | 1051 | 1052 | 1053 | 1054 | 1055 | 1056 | 1057 | 1058 | 1059 | 1060 | 1061 | 1062 | 1063 | 1065 | 1066 | 1068 | 1069 | 1070 | 1071 | 1072 | 1073 | 1074 | 1075 | 1076 | 1077 | 1078 | 1079 | 1080 | 1081 | 1082 | 1083 | 1084 | 1085 | 1086 | 1087 | 1088 | 1089 | 1090 | 1091 | 1092 | 1093 | 1094 | 1095 | 1096 | 1097 | 1098 | 1099 | 1100 | 1101 | 1102 | 1103 | 1104 | 1105 | 1106 | 1107 | 1108 | 1109 | 1110 | 1111 | 1112 | 1113 | 1114 | 1115 | 1116 | 1117 | 1118 | 1119 | 1120 | 1121 | 1122 | 1123 | 1124 | 1125 | 1126 | 1127 | 1128 | 1129 | 1130 | 1131 | 1132 | 1133 | 1134 | 1135 | 1136 | 1137 | 1138 | 1139 | 1140 | 1141 | 1142 | 1143 | 1144 | 1145 | 1146 | 1147 | 1148 | 1149 | 1150 | 1151 | 1152 | 1153 | 1154 | 1155 | 1156 | 1157 | 1158 | 1159 | 1160 | 1161 | 1162 | 1163 | 1164 | 1165 | 1166 | 1167 | 1168 | 1169 | 1170 | 1171 | 1172 | 1173 | 1174 | 1175 | 1176 | 1177 | 1178 | 1179 | 1180 | 1181 | 1182 | 1183 | 1184 | 1185 | 1186 | 1187 | 1188 | 1189 | 1190 | 1191 | 1192 | 1193 | 1194 | 1195 | 1196 | 1197 | 1198 | 1199 | 1200 | 1201 | 1202 | 1203 | 1204 | 1205 | 1206 | 1207 | 1208 | 1209 | 1210 | 1211 | 1212 | 1213 | 1214 | 1215 | 1216 | 1217 | 1218 | 1219 | 1220 | 1221 | 1222 | 1223 | 1224 | 1225 | 1226 | 1227 | 1228 | 1229 | 1230 | 1231 | 1232 | 1233 | 1234 | 1235 | 1236 | 1237 | 1238 | 1239 | 1240 | 1241 | 1242 | 1243 | 1244 | 1245 | 1246 | 1247 | 1248 | 1249 | 1250 | 1251 | 1252 | 1253 | 1254 | 1255 | 1256 | 1257 | 1258 | 1259 | 1260 | 1261 | 1262 | 1263 | 1264 | 1265 | 1266 | 1267 | 1268 | 1269 | 1270 | 1271 | 1272 | 1273 | 1274 | 1275 | 1276 | 1277 | 1278 | 1279 | 1280 | 1281 | 1282 | 1283 | 1284 | 1285 | 1286 | 1287 | 1288 | 1289 | 1290 | 1291 | 1292 | 1293 | 1294 | 1295 | 1296 | 1297 | 1298 | 1299 | Python 2.7 interpreter library 1300 | 1301 | 1306 | 1307 | 1308 | 1309 | 1310 | 1311 | 1.8 1312 | 1313 | 1318 | 1319 | 1320 | 1321 | 1322 | 1323 | 1.8 1324 | 1325 | 1330 | 1331 | 1332 | 1333 | 1334 | 1335 | 1336 | 1341 | 1342 | 1343 | 1344 | 1345 | 1346 | 1347 | 1352 | 1353 | 1354 | 1355 | 1356 | 1357 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # springboot2-email 2 | springboot邮件发送 3 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.ligh 7 | email 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | email 12 | Demo project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 2.1.0.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-test 35 | test 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-thymeleaf 40 | 41 | 42 | com.alibaba 43 | fastjson 44 | 1.2.31 45 | 46 | 47 | org.springframework.boot 48 | spring-boot-starter-mail 49 | 50 | 51 | 52 | org.springframework.boot 53 | spring-boot-starter-thymeleaf 54 | 55 | 56 | 57 | org.springframework.boot 58 | spring-boot-starter-freemarker 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | org.springframework.boot 67 | spring-boot-maven-plugin 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/main/java/com/ligh/EmailApplication.java: -------------------------------------------------------------------------------- 1 | package com.ligh; 2 | 3 | 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | 8 | @SpringBootApplication 9 | 10 | public class EmailApplication { 11 | public static void main(String[] args) { 12 | SpringApplication.run(EmailApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/ligh/service/MailService.java: -------------------------------------------------------------------------------- 1 | package com.ligh.service; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.beans.factory.annotation.Value; 7 | import org.springframework.core.io.FileSystemResource; 8 | import org.springframework.mail.SimpleMailMessage; 9 | import org.springframework.mail.javamail.JavaMailSender; 10 | import org.springframework.mail.javamail.MimeMessageHelper; 11 | import org.springframework.stereotype.Service; 12 | 13 | import javax.mail.MessagingException; 14 | import javax.mail.internet.MimeMessage; 15 | import java.io.File; 16 | 17 | /** 18 | * Created by ${ligh} on 2018/12/7 上午9:08 19 | */ 20 | 21 | @Service 22 | public class MailService { 23 | 24 | private final Logger logger = LoggerFactory.getLogger(this.getClass()); 25 | 26 | @Value("${spring.mail.username}") 27 | private String from; 28 | 29 | @Autowired 30 | private JavaMailSender mailSender; 31 | 32 | 33 | /** 34 | * 发送文本邮件 35 | * 36 | * @param to 接收人 37 | * @param subject 主题 38 | * @param content 邮件内容 39 | */ 40 | public void sendSimpleMail(String to,String subject,String content){ 41 | SimpleMailMessage message = new SimpleMailMessage(); 42 | message.setTo(to); 43 | message.setSubject(subject); 44 | message.setText(content); 45 | message.setFrom(from); 46 | mailSender.send(message); 47 | 48 | } 49 | 50 | /** 51 | * 发送HTML邮件 52 | * 53 | * @param to 54 | * @param subject 55 | * @param content 56 | */ 57 | public void sendHtmlMail(String to,String subject,String content) throws Exception { 58 | 59 | MimeMessage mimeMessage = mailSender.createMimeMessage(); 60 | MimeMessageHelper helper = new MimeMessageHelper(mimeMessage,true); 61 | 62 | helper.setFrom(from); 63 | helper.setTo(to); 64 | helper.setSubject(subject); 65 | helper.setText(content,true); 66 | mailSender.send(mimeMessage); 67 | } 68 | 69 | /** 70 | * 发送带副本的邮件 71 | * 72 | * @param to 73 | * @param subject 74 | * @param content 75 | */ 76 | public void sendAttachmentMail(String to,String subject,String content,String filepath) throws Exception { 77 | MimeMessage message = mailSender.createMimeMessage(); 78 | MimeMessageHelper helper = new MimeMessageHelper(message,true); 79 | helper.setFrom(from); 80 | helper.setTo(to); 81 | helper.setSubject(subject); 82 | helper.setText(content,true); 83 | 84 | //文件流:获取本地文件 85 | FileSystemResource file = new FileSystemResource(new File(filepath)); 86 | String filename = file.getFilename(); 87 | //可以发送多个 88 | helper.addAttachment(filename,file); 89 | // helper.addAttachment(filename+"_test",file); 90 | 91 | //进行发送 92 | mailSender.send(message); 93 | } 94 | 95 | /** 96 | * 发送图片邮件 97 | * 98 | * @param to 99 | * @param subject 100 | * @param content 101 | * @param rscPath 102 | * @param rscId 103 | * @throws Exception 104 | */ 105 | public void sendImageMail(String to,String subject,String content,String rscPath,String rscId){ 106 | logger.info("发送静态邮件开始: {},{},{},{},{}",to,subject,content,rscPath,rscId); 107 | MimeMessage message = mailSender.createMimeMessage(); 108 | MimeMessageHelper helper = null; 109 | try{ 110 | helper = new MimeMessageHelper(message, true); 111 | helper.setFrom(from); 112 | helper.setTo(to); 113 | helper.setSubject(subject); 114 | helper.setText(content,true); 115 | 116 | FileSystemResource file = new FileSystemResource(new File(rscPath)); 117 | helper.addInline(rscId,file); 118 | mailSender.send(message); 119 | logger.info("发送静态图片邮件成功!"); 120 | }catch (Exception e){ 121 | logger.error("发送静态邮件失败!",e); 122 | } 123 | 124 | } 125 | } 126 | 127 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8888 2 | 3 | # 邮箱环境配置 4 | 5 | spring.mail.host=smtp.qq.com 6 | spring.mail.username=978719229@qq.com 7 | spring.mail.password=ctccpxtefqfabfgc 8 | spring.mail.default-encoding=UTF-8 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | #关闭缓存,即时刷新 32 | #spring.freemarker.cache=false 33 | 34 | 35 | #热部署生效 36 | spring.devtools.restart.enabled=true 37 | #设置重启的目录,添加那个目录的文件需要restart 38 | spring.devtools.restart.additional-paths=src/main/java 39 | #为mybatis设置,生产环境可删除 40 | #restart.include.mapper=/mapper-[\\w-\\.]+jar 41 | #restart.include.pagehelper=/pagehelper-[\\w-\\.]+jar 42 | #排除那个目录的文件不需要restart 43 | spring.devtools.restart.exclude=static/**,public/** 44 | #classpath目录下的WEB-INF文件夹内容修改不重启 45 | #spring.devtools.restart.exclude=WEB-INF/** 46 | #server.servlet.context-path=/imooc 47 | server.servlet.session.timeout=60 48 | #配置完成之后通过localhost不能再访问本项目,只有通过ip 49 | #server.address=192.168.1.108 50 | #配置编码格式 51 | server.tomcat.uri-encoding=UTF-8 52 | 53 | #存放tomcat的日志,Dump等文件的临时文件夹,默认为系统的tmp文件夹 54 | #server.tomcat.basedir=H:/springboot-tomcat-tmp 55 | 56 | #打开Tomcat的Access日志,并可以设置日志格式的方法 57 | #server.tomcat.accesslog.enabled=true 58 | #server.tomcat.accesslog.pattern= 59 | 60 | #access.log目录,默认在basedir/logs 61 | #server.tomcat.accesslog.directory= 62 | 63 | #日志文件目录 64 | #logging.path=H:/springboot-tomcat-tmp 65 | 66 | #日志文件名称,默认为spring.log 67 | #logging.file=myapp.log 68 | 69 | 70 | # 配置i18n的资源文件, 71 | spring.messages.basename=i18n/messages 72 | spring.messages.encoding=UTF-8 73 | 74 | 75 | # 配置数据库 76 | 77 | #spring.datasource.url=jdbc:mysql://localhost:3306/ligh?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&autoReconnect=true 78 | #spring.datasource.username=root 79 | #spring.datasource.password=7d428bc667 80 | #spring.datasource.driver-class-name=com.mysql.jdbc.Driver 81 | #spring.datasource.druid.initial-size=1 82 | #spring.datasource.druid.min-idle=1 83 | #spring.datasource.druid.max-active=20 84 | #spring.datasource.druid.test-on-borrow=true 85 | #spring.datasource.druid.stat-view-servlet.allow=true 86 | # 87 | 88 | #设置静态文件路径,js,css等 89 | spring.mvc.static-path-pattern=/static/** 90 | 91 | 92 | # freemarker 静态资源配置 93 | 94 | spring.freemarker.template-loader-path=classpath:/templates/ 95 | 96 | # 关闭缓存,即时刷新,上线生产环境需要改为true 97 | spring.freemarker.cache=false 98 | spring.freemarker.charset=UTF-8 99 | spring.freemarker.check-template-location=true 100 | spring.freemarker.content-type=text/html 101 | spring.freemarker.expose-request-attributes=true 102 | spring.freemarker.expose-session-attributes=true 103 | spring.freemarker.request-context-attribute=request 104 | spring.freemarker.suffix=.ftl 105 | 106 | 107 | 108 | 109 | 110 | # thymeleaf 静态资源文件配置 111 | 112 | spring.thymeleaf.prefix=classpath:/templates/ 113 | spring.thymeleaf.suffix=.html 114 | spring.thymeleaf.mode=HTML5 115 | spring.thymeleaf.encoding=UTF-8 116 | spring.thymeleaf.servlet.content-type=text/html 117 | #关闭缓存,即时刷新,上线生产环境需要改为true 118 | spring.thymeleaf.cache=true 119 | 120 | 121 | 122 | ############################################################ 123 | # 124 | # Redis 使用配置 125 | # 126 | ############################################################ 127 | spring.redis.database=1 128 | spring.redis.host=192.168.1.131 129 | spring.redis.port=6379 130 | spring.redis.password= 131 | spring.redis.jedis.pool.max-active=1000 132 | spring.redis.jedis.pool.max-wait=-1 133 | spring.redis.jedis.pool.max-idle=10 134 | spring.redis.jedis.pool.min-idle=2 135 | spring.redis.timeout=200 136 | 137 | -------------------------------------------------------------------------------- /src/main/resources/templates/templates.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 邮件模板 6 | 7 | 8 | 您好,感谢您的注册,这是一封验证邮件,请点击下面的连接完成注册,感谢您的支持 9 | 激活账号 10 | 11 | -------------------------------------------------------------------------------- /src/test/java/com/ligh/test/TestSpringbootEmail.java: -------------------------------------------------------------------------------- 1 | package com.ligh.test; 2 | 3 | import com.ligh.service.MailService; 4 | import org.junit.Test; 5 | import org.junit.runner.RunWith; 6 | import org.springframework.boot.test.context.SpringBootTest; 7 | import org.springframework.test.context.junit4.SpringRunner; 8 | import org.thymeleaf.TemplateEngine; 9 | import org.thymeleaf.context.Context; 10 | 11 | import javax.annotation.Resource; 12 | 13 | /** 14 | * Created by ${ligh} on 2018/12/7 上午9:23 15 | */ 16 | @RunWith(SpringRunner.class) 17 | @SpringBootTest 18 | public class TestSpringbootEmail { 19 | 20 | @Resource 21 | MailService mailService; 22 | 23 | @Resource 24 | TemplateEngine templateEngine; 25 | 26 | /** 27 | * 简单文本邮件发送 28 | */ 29 | @Test 30 | public void sendSimpleMailTest(){ 31 | mailService.sendSimpleMail("liguohui@163.com","简单文本邮件","这是我的第一封邮件,哈哈..."); 32 | } 33 | 34 | /** 35 | * HTML邮件发送 36 | * 37 | * @throws Exception 38 | */ 39 | @Test 40 | public void sendHtmlMailTest() throws Exception{ 41 | 42 | String content = "\n"+ 43 | "\n" + 44 | "

hello world , 这是一封HTML邮件

"+ 45 | "\n"+ 46 | ""; 47 | 48 | 49 | mailService.sendHtmlMail("liguohui@163.com","Html邮件发送",content); 50 | } 51 | 52 | /** 53 | * 发送副本邮件 54 | * 55 | * @throws Exception 56 | */ 57 | @Test 58 | public void sendAttachmentMailTest() throws Exception{ 59 | String filepath = "/Users/fish/Desktop/linux 常用命令.pdf"; 60 | 61 | mailService.sendAttachmentMail("liguohui@163.com","发送副本","这是一篇带附件的邮件",filepath); 62 | 63 | } 64 | 65 | /** 66 | * 发送图片邮件 67 | * 68 | * @throws Exception 69 | */ 70 | @Test 71 | public void sendImageMailTest() throws Exception{ 72 | //发送多个图片的话可以定义多个 rscId,定义多个img标签 73 | 74 | String filePath = "/Users/fish/Desktop/test.png"; 75 | String rscId = "ligh001"; 76 | String content = " 这是有图片的邮件: "; 77 | 78 | mailService.sendImageMail("liguohui@huluwa.cc","这是一个带图片的邮件",content,filePath,rscId); 79 | } 80 | 81 | /** 82 | * 发送邮件模板 83 | * 84 | * @throws Exception 85 | */ 86 | @Test 87 | public void sendTemplateEmailTest() throws Exception { 88 | Context context = new Context(); 89 | context.setVariable("id","006"); 90 | String emailContent = templateEngine.process("templates",context); 91 | mailService.sendHtmlMail("lighAsqh@163.com","这是一个模板文件",emailContent); 92 | } 93 | 94 | 95 | } 96 | -------------------------------------------------------------------------------- /target/classes/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8888 2 | 3 | # 邮箱环境配置 4 | 5 | spring.mail.host=smtp.qq.com 6 | spring.mail.username=978719229@qq.com 7 | spring.mail.password=ctccpxtefqfabfgc 8 | spring.mail.default-encoding=UTF-8 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | #关闭缓存,即时刷新 32 | #spring.freemarker.cache=false 33 | 34 | 35 | #热部署生效 36 | spring.devtools.restart.enabled=true 37 | #设置重启的目录,添加那个目录的文件需要restart 38 | spring.devtools.restart.additional-paths=src/main/java 39 | #为mybatis设置,生产环境可删除 40 | #restart.include.mapper=/mapper-[\\w-\\.]+jar 41 | #restart.include.pagehelper=/pagehelper-[\\w-\\.]+jar 42 | #排除那个目录的文件不需要restart 43 | spring.devtools.restart.exclude=static/**,public/** 44 | #classpath目录下的WEB-INF文件夹内容修改不重启 45 | #spring.devtools.restart.exclude=WEB-INF/** 46 | #server.servlet.context-path=/imooc 47 | server.servlet.session.timeout=60 48 | #配置完成之后通过localhost不能再访问本项目,只有通过ip 49 | #server.address=192.168.1.108 50 | #配置编码格式 51 | server.tomcat.uri-encoding=UTF-8 52 | 53 | #存放tomcat的日志,Dump等文件的临时文件夹,默认为系统的tmp文件夹 54 | #server.tomcat.basedir=H:/springboot-tomcat-tmp 55 | 56 | #打开Tomcat的Access日志,并可以设置日志格式的方法 57 | #server.tomcat.accesslog.enabled=true 58 | #server.tomcat.accesslog.pattern= 59 | 60 | #access.log目录,默认在basedir/logs 61 | #server.tomcat.accesslog.directory= 62 | 63 | #日志文件目录 64 | #logging.path=H:/springboot-tomcat-tmp 65 | 66 | #日志文件名称,默认为spring.log 67 | #logging.file=myapp.log 68 | 69 | 70 | # 配置i18n的资源文件, 71 | spring.messages.basename=i18n/messages 72 | spring.messages.encoding=UTF-8 73 | 74 | 75 | # 配置数据库 76 | 77 | #spring.datasource.url=jdbc:mysql://localhost:3306/ligh?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&autoReconnect=true 78 | #spring.datasource.username=root 79 | #spring.datasource.password=7d428bc667 80 | #spring.datasource.driver-class-name=com.mysql.jdbc.Driver 81 | #spring.datasource.druid.initial-size=1 82 | #spring.datasource.druid.min-idle=1 83 | #spring.datasource.druid.max-active=20 84 | #spring.datasource.druid.test-on-borrow=true 85 | #spring.datasource.druid.stat-view-servlet.allow=true 86 | # 87 | 88 | #设置静态文件路径,js,css等 89 | spring.mvc.static-path-pattern=/static/** 90 | 91 | 92 | # freemarker 静态资源配置 93 | 94 | spring.freemarker.template-loader-path=classpath:/templates/ 95 | 96 | # 关闭缓存,即时刷新,上线生产环境需要改为true 97 | spring.freemarker.cache=false 98 | spring.freemarker.charset=UTF-8 99 | spring.freemarker.check-template-location=true 100 | spring.freemarker.content-type=text/html 101 | spring.freemarker.expose-request-attributes=true 102 | spring.freemarker.expose-session-attributes=true 103 | spring.freemarker.request-context-attribute=request 104 | spring.freemarker.suffix=.ftl 105 | 106 | 107 | 108 | 109 | 110 | # thymeleaf 静态资源文件配置 111 | 112 | spring.thymeleaf.prefix=classpath:/templates/ 113 | spring.thymeleaf.suffix=.html 114 | spring.thymeleaf.mode=HTML5 115 | spring.thymeleaf.encoding=UTF-8 116 | spring.thymeleaf.servlet.content-type=text/html 117 | #关闭缓存,即时刷新,上线生产环境需要改为true 118 | spring.thymeleaf.cache=true 119 | 120 | 121 | 122 | ############################################################ 123 | # 124 | # Redis 使用配置 125 | # 126 | ############################################################ 127 | spring.redis.database=1 128 | spring.redis.host=192.168.1.131 129 | spring.redis.port=6379 130 | spring.redis.password= 131 | spring.redis.jedis.pool.max-active=1000 132 | spring.redis.jedis.pool.max-wait=-1 133 | spring.redis.jedis.pool.max-idle=10 134 | spring.redis.jedis.pool.min-idle=2 135 | spring.redis.timeout=200 136 | 137 | -------------------------------------------------------------------------------- /target/classes/com/ligh/EmailApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fire-basketball/springboot2-email/d803f4f70872d37e5056c72392c74f943cacf8ea/target/classes/com/ligh/EmailApplication.class -------------------------------------------------------------------------------- /target/classes/com/ligh/service/MailService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fire-basketball/springboot2-email/d803f4f70872d37e5056c72392c74f943cacf8ea/target/classes/com/ligh/service/MailService.class -------------------------------------------------------------------------------- /target/classes/templates/templates.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 邮件模板 6 | 7 | 8 | 您好,感谢您的注册,这是一封验证邮件,请点击下面的连接完成注册,感谢您的支持 9 | 激活账号 10 | 11 | -------------------------------------------------------------------------------- /target/test-classes/com/ligh/test/TestSpringbootEmail.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fire-basketball/springboot2-email/d803f4f70872d37e5056c72392c74f943cacf8ea/target/test-classes/com/ligh/test/TestSpringbootEmail.class -------------------------------------------------------------------------------- /笔记.txt: -------------------------------------------------------------------------------- 1 | 2 | 一.代码实现: 3 | 4 | 发送文本邮件 5 | 6 | 发送HTML邮件 7 | 8 | 发送附件邮件 9 | 10 | 发送带图片的邮件 11 | 12 | 邮件模板 13 | 14 | 邮件系统 15 | 16 | 17 | 二.邮件使用背景: 18 | 19 | 注册验证 20 | 21 | 网站营销 22 | 23 | 安全的最后一道防线 24 | 25 | 提醒,监控警告 26 | 27 | 触发机制 28 | 29 | 三.发送邮件的原理: 30 | 31 | 邮件传输协议: SMTP(把邮件从一台服务器发送到另外一台服务器)协议和POP3(把邮件从服务器上拿下来看)协议 32 | 33 | 内容不断发展: IMAP(保持客户端和服务器上的邮件的状态一致)协议和Mime(通过SMTP进行传输)协议 34 | 35 | 36 | 四.简单文本邮件 37 | 38 | 引入相关jar包 39 | 40 | 41 | org.springframework.boot 42 | spring-boot-starter-email 43 | 44 | 45 | 配置邮箱参数 46 | 47 | spring.mail.host=smtp.huluwa.cc //采用smtp形式的传输方式 48 | spring.mail.username=liguohui@huluwa.cc 49 | spring.mail.password=Huluwa110 50 | spring.mail.default-encoding=UTF-8 51 | 52 | 封装SimpleMailMessage 53 | 54 | @Autowired 55 | private JavaMailSender mailSender; 56 | @Value("${spring.mail.username}") 57 | private String from; 58 | 59 | JavaMailSender进行发送 60 | 61 | //封装邮件发送方法 62 | public void sendSimpleMail(String to,String subject,String content){ 63 | SimpleMailMessage message = new SimpleMailMessage(); 64 | message.setTo(to); 65 | message.setSubject(subject); 66 | message.setText(content); 67 | message.setFrom(from); 68 | mailSender.send(message); 69 | 70 | } 71 | 72 | 73 | 74 | 75 | 76 | --------------------------------------------------------------------------------