今天群裏的小夥伴問了如何配置郵件的問題,隨自己在sap裏面配置了一個
1. RZ10配置參數
a) 参数配置前,先导入激活版本
执行完毕后返回
b) 输入参数文件DEFAULT,点击修改
c) 查看是否存在下面2条参数配置
is/SMTP/virt_host_0 值: *:25;
icm/server_port_1 值: PROT=SMTP,PORT=25,TIMEOUT=60,PROCTIMEOUT=120
没有则需要创建。
注意:若是端口25被占用,可以使用其他端口。
端口配置参数为icm/server_port_*。
如果需要在多个client中收发邮件,则需要在每个client中配置虚拟邮件主机参数:
is/SMTP/virt_host_*。最多可以添加10个。
icm/server_port_<*> = PROT=SMTP,PORT=<port>
is/SMTP/virt_host_<*> = <host>:<port>,<port>,...;
如下图为配置完得参数:
注意配置完之後要點擊 左上方的複製按鈕,
返回後點擊保存並激活
2. 端口检查
事务码:SMICM
a) 点击服务按钮
没有SMTP的服务,创建一个,若端口不是25000可以删除并重新创建一个
此时可以看到SMTP服务已经激活
3. 用户配置
我们需要创建一个邮件服务mail server 用户,profile 赋值权限S_A.SCON,并给所使用SAP SMTP功能的用户分配一个邮箱地址
a) TCODE:SU01 用户类型改为系统
我们需要创建一个邮件服务mail server 用户,profile 赋值权限S_A.SCON,并给所使用SAP SMTP功能的用户分配一个邮箱地址
b) 参数文件添加 S_A.SCON
c) 给所有用的邮件功能的用户分配邮箱地址(不是上面的mail server)
4. SICF配置
修改HOST配置
直接进入点执行,右击并激活SMTP主机
5. SAPconnect服务管理配置(SCOT)
1. 使用向导创建节
输入节点和名称
指定主机名和端口
点击 设置:
下面輸入的密碼不一定是qq密碼,若是qq郵箱啓用了安全
指定地址区域
指定文档输出格式
失败的发送间隔
配置缺省域
2. 配置发送作业
10分钟发送一次。
6. 测试
TCODE SBWP 进入工作台点击新邮件
输入标题,内容,收件人,点击发送邮件
然后去SOST中
状态为已发送,qq邮箱中有收到邮件
至此,邮件服务器已经配置完毕
7. 其他功能
sost : 所有待发送的邮件清单,也可以监视邮件发送状态,也可以在此页面发送邮件!
sbwp:发送邮件功能
so01 :邮件/消息
8. 用ABAP发送邮件代码
1 REPORT ztest_jxzhu_mail. 2 3 4 */.. Internal Table Declaration 5 DATA: li_otf TYPE TABLE OF itcoo, 6 li_pdf_tab TYPE TABLE OF tline, 7 li_content_txt TYPE soli_tab, 8 li_content_hex TYPE solix_tab, 9 li_objhead TYPE soli_tab, 10 gi_main_text TYPE bcsy_text. 11 12 13 14 */.. Work Area Declarations 15 DATA: lw_control_parameters TYPE ssfctrlop, 16 lw_output_options TYPE ssfcompop, 17 lw_ssfcrescl TYPE ssfcrescl, 18 lw_content TYPE soli, 19 lw_otf TYPE itcoo. 20 */..Variables Decalrations 21 22 DATA: gv_fname TYPE rs38l_fnam, "fucntion MODULE 23 gv_subject TYPE so_obj_des, 24 gv_title TYPE so_obj_des, 25 lv_bin_filesize TYPE i, 26 lv_transfer_bin TYPE sx_boolean, 27 lv_len TYPE so_obj_len, 28 lv_email TYPE ad_smtpadr, 29 lv_sent_to_all TYPE os_boolean. 30 */.. Class Declarations 31 32 DATA: go_send_request TYPE REF TO cl_bcs, 33 go_document TYPE REF TO cl_document_bcs, 34 lo_recipient TYPE REF TO if_recipient_bcs, 35 lo_bcs_exception TYPE REF TO cx_bcs. 36 37 38 39 CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME' 40 EXPORTING 41 formname = 'ZF2_TEST' 42 IMPORTING 43 fm_name = gv_fname 44 EXCEPTIONS 45 no_form = 1 46 no_function_module = 2 47 OTHERS = 3. 48 49 IF sy-subrc <> 0. 50 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno 51 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. 52 ENDIF. 53 54 55 56 57 */.. Get OTF data 58 lw_control_parameters-getotf = 'X'. 59 */.. To supress preview 60 lw_control_parameters-no_dialog = 'X'. 61 lw_control_parameters-langu = sy-langu. 62 lw_output_options-tdnoprev = 'X'. 63 64 */.. To add multiple attachments write below code till Add attachment method in LOOP and ENDLOOP. 65 66 */.. Call Smart Form FM 67 CALL FUNCTION gv_fname 68 EXPORTING 69 control_parameters = lw_control_parameters 70 output_options = lw_output_options 71 user_settings = 'X' 72 IMPORTING 73 job_output_info = lw_ssfcrescl 74 EXCEPTIONS 75 formatting_error = 1 76 internal_error = 2 77 send_error = 3 78 user_canceled = 4 79 OTHERS = 5. 80 IF sy-subrc <> 0. 81 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno 82 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. 83 ENDIF. 84 85 86 87 88 */.. Get OTF data to convert to PDF 89 REFRESH li_otf[]. 90 li_otf[] = lw_ssfcrescl-otfdata[]. 91 CLEAR : lv_bin_filesize. 92 93 94 */.. Convert OTF data to binary 95 CALL FUNCTION 'CONVERT_OTF' 96 EXPORTING 97 format = 'PDF' 98 IMPORTING 99 bin_filesize = lv_bin_filesize 100 TABLES 101 otf = li_otf 102 lines = li_pdf_tab 103 EXCEPTIONS 104 err_max_linewidth = 1 105 err_format = 2 106 err_conv_not_possible = 3 107 err_bad_otf = 4 108 OTHERS = 5. 109 IF sy-subrc <> 0. 110 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno 111 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. 112 ENDIF. 113 REFRESH li_content_txt. 114 115 116 LOOP AT li_otf INTO lw_otf. 117 CLEAR lw_content. 118 CONCATENATE lw_otf-tdprintcom lw_otf-tdprintpar 119 INTO lw_content. 120 APPEND lw_content TO li_content_txt. 121 122 ENDLOOP. 123 REFRESH : li_content_hex, 124 li_objhead. 125 CLEAR : lv_transfer_bin, 126 lv_len. 127 */.. FM to convert OTF to PDF 128 CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF' 129 EXPORTING 130 format_src = 'OTF' 131 format_dst = 'PDF' 132 CHANGING 133 transfer_bin = lv_transfer_bin 134 content_txt = li_content_txt 135 content_bin = li_content_hex 136 objhead = li_objhead 137 len = lv_len 138 EXCEPTIONS 139 err_conv_failed = 1 140 OTHERS = 2. 141 IF sy-subrc <> 0. 142 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno 143 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. 144 ENDIF. 145 146 TRY. 147 */.. Create persistent send request 148 go_send_request = cl_bcs=>create_persistent( ). 149 go_document = cl_document_bcs=>create_document( 150 i_type = 'RAW' 151 i_text = gi_main_text 152 i_subject = gv_subject ). 153 154 IF NOT li_content_hex IS INITIAL. 155 go_document->add_attachment( 156 i_attachment_type = 'PDF' 157 i_attachment_subject = gv_title 158 i_attachment_size = lv_len 159 i_att_content_hex = li_content_hex ). 160 ENDIF. 161 */.. Add document object to send request 162 go_send_request->set_document( go_document ). 163 164 lv_email = '123456789@qq.com'. 165 166 */.. Add recipient (e-mail address) 167 */.. create recipient object 168 lo_recipient = cl_cam_address_bcs=>create_internet_address( 169 lv_email ). 170 171 */.. Add recipient object to send request 172 go_send_request->add_recipient( lo_recipient ). 173 174 */.. Send document 175 lv_sent_to_all = go_send_request->send( i_with_error_screen = 176 abap_true ). 177 178 COMMIT WORK. 179 180 SUBMIT rsconn01 WITH mode = 'INT' 181 WITH output = '' 182 AND RETURN. 183 184 IF lv_sent_to_all IS INITIAL. 185 "error message 186 ELSE. 187 "success message 188 ENDIF. 189 190 */.. Exception handling 191 CATCH cx_bcs INTO lo_bcs_exception. 192 "exception handling 193 ENDTRY.
- TAB 熱愛技術 享受生活