今天群裏的小夥伴問了如何配置郵件的問題,隨自己在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发送邮件代码
REPORT ztest_jxzhu_mail. */.. Internal Table Declaration
DATA: li_otf TYPE TABLE OF itcoo,
li_pdf_tab TYPE TABLE OF tline,
li_content_txt TYPE soli_tab,
li_content_hex TYPE solix_tab,
li_objhead TYPE soli_tab,
gi_main_text TYPE bcsy_text. */.. Work Area Declarations
DATA: lw_control_parameters TYPE ssfctrlop,
lw_output_options TYPE ssfcompop,
lw_ssfcrescl TYPE ssfcrescl,
lw_content TYPE soli,
lw_otf TYPE itcoo.
*/..Variables Decalrations DATA: gv_fname TYPE rs38l_fnam, "fucntion MODULE
gv_subject TYPE so_obj_des,
gv_title TYPE so_obj_des,
lv_bin_filesize TYPE i,
lv_transfer_bin TYPE sx_boolean,
lv_len TYPE so_obj_len,
lv_email TYPE ad_smtpadr,
lv_sent_to_all TYPE os_boolean.
*/.. Class Declarations DATA: go_send_request TYPE REF TO cl_bcs,
go_document TYPE REF TO cl_document_bcs,
lo_recipient TYPE REF TO if_recipient_bcs,
lo_bcs_exception TYPE REF TO cx_bcs. CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZF2_TEST'
IMPORTING
fm_name = gv_fname
EXCEPTIONS
no_form =
no_function_module =
OTHERS = . IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. */.. Get OTF data
lw_control_parameters-getotf = 'X'.
*/.. To supress preview
lw_control_parameters-no_dialog = 'X'.
lw_control_parameters-langu = sy-langu.
lw_output_options-tdnoprev = 'X'. */.. To add multiple attachments write below code till Add attachment method in LOOP and ENDLOOP. */.. Call Smart Form FM
CALL FUNCTION gv_fname
EXPORTING
control_parameters = lw_control_parameters
output_options = lw_output_options
user_settings = 'X'
IMPORTING
job_output_info = lw_ssfcrescl
EXCEPTIONS
formatting_error =
internal_error =
send_error =
user_canceled =
OTHERS = .
IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. */.. Get OTF data to convert to PDF
REFRESH li_otf[].
li_otf[] = lw_ssfcrescl-otfdata[].
CLEAR : lv_bin_filesize. */.. Convert OTF data to binary
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = lv_bin_filesize
TABLES
otf = li_otf
lines = li_pdf_tab
EXCEPTIONS
err_max_linewidth =
err_format =
err_conv_not_possible =
err_bad_otf =
OTHERS = .
IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
REFRESH li_content_txt. LOOP AT li_otf INTO lw_otf.
CLEAR lw_content.
CONCATENATE lw_otf-tdprintcom lw_otf-tdprintpar
INTO lw_content.
APPEND lw_content TO li_content_txt. ENDLOOP.
REFRESH : li_content_hex,
li_objhead.
CLEAR : lv_transfer_bin,
lv_len.
*/.. FM to convert OTF to PDF
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = 'OTF'
format_dst = 'PDF'
CHANGING
transfer_bin = lv_transfer_bin
content_txt = li_content_txt
content_bin = li_content_hex
objhead = li_objhead
len = lv_len
EXCEPTIONS
err_conv_failed =
OTHERS = .
IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. TRY.
*/.. Create persistent send request
go_send_request = cl_bcs=>create_persistent( ).
go_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = gi_main_text
i_subject = gv_subject ). IF NOT li_content_hex IS INITIAL.
go_document->add_attachment(
i_attachment_type = 'PDF'
i_attachment_subject = gv_title
i_attachment_size = lv_len
i_att_content_hex = li_content_hex ).
ENDIF.
*/.. Add document object to send request
go_send_request->set_document( go_document ). lv_email = '123456789@qq.com'. */.. Add recipient (e-mail address)
*/.. create recipient object
lo_recipient = cl_cam_address_bcs=>create_internet_address(
lv_email ). */.. Add recipient object to send request
go_send_request->add_recipient( lo_recipient ). */.. Send document
lv_sent_to_all = go_send_request->send( i_with_error_screen =
abap_true ). COMMIT WORK. SUBMIT rsconn01 WITH mode = 'INT'
WITH output = ''
AND RETURN. IF lv_sent_to_all IS INITIAL.
"error message
ELSE.
"success message
ENDIF. */.. Exception handling
CATCH cx_bcs INTO lo_bcs_exception.
"exception handling
ENDTRY.
- TAB 熱愛技術 享受生活