REPORT z_test_email.
DATA:
subject TYPE so_obj_des,
it_body_text TYPE soli_tab,
it_body_html TYPE soli_tab,
from TYPE ad_smtpadr,
to TYPE ad_smtpadr.
DATA:
document TYPE REF TO cl_document_bcs,
request TYPE REF TO cl_bcs,
mime_helper TYPE REF TO cl_gbt_multirelated_service,
sender TYPE REF TO if_sender_bcs,
recipient TYPE REF TO if_recipient_bcs.
to = 'receiver@gmail.com'.
from = 'sendor@gmail.com'.
subject = 'Test Email Data'.
APPEND 'Hello World' TO it_body_text.
APPEND 'Column 1 Column 2' TO it_body_text.
APPEND 'a b' TO it_body_text.
APPEND 'xyz test' TO it_body_text.
APPEND '4711 0815' TO it_body_text.
APPEND '<html>' TO it_body_html.
APPEND '<head>' TO it_body_html.
APPEND '<title>MY HTML part</title>' TO it_body_html.
APPEND '</head>' TO it_body_html.
APPEND '<body>' TO it_body_html.
APPEND '<h1>Hello World!</h1>' TO it_body_html.
APPEND '<table border="1">' TO it_body_html.
APPEND '<tr><td>Column 1</td><td>Column 2</td></tr>' TO it_body_html.
APPEND '<tr><td>a</td><td>b</td></tr>' TO it_body_html.
APPEND '<tr><td>xyz</td><td>test</td></tr>' TO it_body_html.
APPEND '<tr><td>4711</td><td>0815</td></tr>' TO it_body_html.
APPEND '</table>' TO it_body_html.
APPEND '</body>' TO it_body_html.
APPEND '</html>' TO it_body_html.
CREATE OBJECT mime_helper.
mime_helper->set_main_text( content = it_body_text ).
mime_helper->set_main_html( content = it_body_html ).
document = cl_document_bcs=>create_from_multirelated(
i_subject = subject
i_multirel_service = mime_helper ).
request = cl_bcs=>create_persistent( ).
request->set_document( document ).
IF from IS NOT INITIAL.
sender = cl_cam_address_bcs=>create_internet_address( from ).
ELSE.
sender = cl_sapuser_bcs=>create( sy-uname ).
ENDIF.
request->set_sender( sender ).
recipient = cl_cam_address_bcs=>create_internet_address( to ).
request->add_recipient( EXPORTING i_recipient = recipient ).
request->set_send_immediately( 'X' ).
IF request->send( i_with_error_screen = 'X' ) = 'X'.
WRITE:/ 'Email sent succesfully'.
ELSE.
WRITE:/ ' Error sending email'.
ENDIF.
COMMIT WORK.
DATA:
subject TYPE so_obj_des,
it_body_text TYPE soli_tab,
it_body_html TYPE soli_tab,
from TYPE ad_smtpadr,
to TYPE ad_smtpadr.
DATA:
document TYPE REF TO cl_document_bcs,
request TYPE REF TO cl_bcs,
mime_helper TYPE REF TO cl_gbt_multirelated_service,
sender TYPE REF TO if_sender_bcs,
recipient TYPE REF TO if_recipient_bcs.
to = 'receiver@gmail.com'.
from = 'sendor@gmail.com'.
subject = 'Test Email Data'.
APPEND 'Hello World' TO it_body_text.
APPEND 'Column 1 Column 2' TO it_body_text.
APPEND 'a b' TO it_body_text.
APPEND 'xyz test' TO it_body_text.
APPEND '4711 0815' TO it_body_text.
APPEND '<html>' TO it_body_html.
APPEND '<head>' TO it_body_html.
APPEND '<title>MY HTML part</title>' TO it_body_html.
APPEND '</head>' TO it_body_html.
APPEND '<body>' TO it_body_html.
APPEND '<h1>Hello World!</h1>' TO it_body_html.
APPEND '<table border="1">' TO it_body_html.
APPEND '<tr><td>Column 1</td><td>Column 2</td></tr>' TO it_body_html.
APPEND '<tr><td>a</td><td>b</td></tr>' TO it_body_html.
APPEND '<tr><td>xyz</td><td>test</td></tr>' TO it_body_html.
APPEND '<tr><td>4711</td><td>0815</td></tr>' TO it_body_html.
APPEND '</table>' TO it_body_html.
APPEND '</body>' TO it_body_html.
APPEND '</html>' TO it_body_html.
CREATE OBJECT mime_helper.
mime_helper->set_main_text( content = it_body_text ).
mime_helper->set_main_html( content = it_body_html ).
document = cl_document_bcs=>create_from_multirelated(
i_subject = subject
i_multirel_service = mime_helper ).
request = cl_bcs=>create_persistent( ).
request->set_document( document ).
IF from IS NOT INITIAL.
sender = cl_cam_address_bcs=>create_internet_address( from ).
ELSE.
sender = cl_sapuser_bcs=>create( sy-uname ).
ENDIF.
request->set_sender( sender ).
recipient = cl_cam_address_bcs=>create_internet_address( to ).
request->add_recipient( EXPORTING i_recipient = recipient ).
request->set_send_immediately( 'X' ).
IF request->send( i_with_error_screen = 'X' ) = 'X'.
WRITE:/ 'Email sent succesfully'.
ELSE.
WRITE:/ ' Error sending email'.
ENDIF.
COMMIT WORK.
댓글 6
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
407 | 팝업창이나 서브스크린 디버깅을 쉽게 할 수 있어요 [17] | 김창훈 | 2007.08.08 | 5071 |
406 | HELP를 WEB으로 접속하려면,,, 이렇게 하세요 [8] | 김창훈 | 2007.08.08 | 3847 |
405 | 간단한 ALV Report를 생성해주는 사이트 [2] | 홍성현 | 2007.08.09 | 4018 |
404 | SAP에서 바코드 인쇄하기 [1] | 홍성현 | 2007.08.09 | 5303 |
403 | Python과 SAP RFC 통신 [3] | 홍성현 | 2007.08.09 | 5808 |
402 | 사용자별 Upload & Download 기본값 [1] | 홍성현 | 2007.08.09 | 3661 |
401 | ABAP에서 웹브라우져 호출 | 홍성현 | 2007.08.09 | 8321 |
400 | SAP Icon 출력 [3] | 홍성현 | 2007.08.09 | 6538 |
399 | ABAP System Fields | 홍성현 | 2007.08.09 | 3931 |
398 | 4.6에서 ALV 필드 변경 안될때 버퍼 지우는 방법 | 신종철 | 2007.08.10 | 4780 |
397 | ALV 중간 집계 하기 [3] | 신종철 | 2007.08.10 | 4780 |
396 | 텍스트반영시(자재명,저장위치명 기타등등) 속도개선 방법 [6] | 김창훈 | 2007.08.14 | 5971 |
395 | 속도개선하기....INDEX를 이렇게도 쓰네용~~ [9] | 김창훈 | 2007.08.14 | 5375 |
394 | AT 구문에 대한 설명입니다. [6] | 김창훈 | 2007.08.16 | 5734 |
393 | 플랜트로 회사코드와 기준통화 찾기 [8] | 김창훈 | 2007.08.16 | 5596 |
392 | 엑셀 65000 라인초과시 사용 유틸 [5] | GG | 2007.08.19 | 5296 |
391 | ABAP 문법 1st [13] | 아일락 | 2007.08.20 | 4555 |
390 | ABAP 문법 2nd [8] | 아일락 | 2007.08.20 | 3914 |
389 | 조회조건 동적으로 보이기 [5] | 신종철™ | 2007.08.20 | 4771 |
388 | 스페이스를 2자리로 먹을때 1자리로 먹게 바꾸기 [1] | 신종철™ | 2007.08.20 | 3952 |
감사합니다.