try.
* 建立傳送請求
l_send_request = cl_bcs=>create_persistent( ).
* 設定傳送內容
l_document = cl_document_bcs=>create_document( i_type =
'raw'
i_text = i_content
i_importance =
'1'i_subject = l_subject )
.* 增加傳送內容到傳送請求
call
method l_send_request->set_document( l_document )
.* 取得傳送者(取得發件人,前提是這個郵箱位址能發郵件,並且不需要密碼)
l_uname = sy-uname.
l_sender = cl_sapuser_bcs=>
create
( l_uname )
.call
method l_send_request->set_sender
exporting
i_sender = l_sender.
* 設定收件人
loop
at it_mailaccept.
concatenate it_mailaccept-name '@***xx.com'
into i_email.
translate i_email to
lower
case
.l_recipient = cl_cam_address_bcs=>create_internet_address( i_email )
.call
method l_send_request->add_recipient
exporting
i_recipient = l_recipient
i_express =
'x'i_copy =
' 'i_blind_copy =
' 'i_no_forward =
' '.
endloop
.* 設定抄送人
loop
at it_mailaccept_copy.
concatenate it_mailaccept_copy-name '@***xx
into i_email.
translate i_email to
lower
case
.l_recipient = cl_cam_address_bcs=>create_internet_address( i_email )
.call
method l_send_request->add_recipient
exporting
i_recipient = l_recipient
i_express =
'x'i_copy =
'x'i_blind_copy =
' 'i_no_forward =
' '.
endloop
.*& 立即傳送
l_send_request->set_send_immediately(
'x' ).
*& 傳送
call
method l_send_request->send( ).
commit
work
.catch cx_document_bcs into l_bcs_exception.
catch cx_send_req_bcs into l_send_exception.
catch cx_address_bcs into l_addr_exception.
endtry
.
VC 實現傳送郵件功能
郵件系統通常採用smtp作為傳送協議,pop3作為接受協議 具體內容參考rfc821 rfc1225 無論是發郵件,還是收郵件都必須要與郵件伺服器連線,再通過郵件資訊結構傳送郵件。vc裡提供了三個類cpop3 連線接受郵件伺服器 csmtp 連線傳送郵件伺服器 cmailmessage 郵件資訊結構...
phpMailer實現傳送郵件功能
require once phpmailer class.phpmailer.php require once phpmailer class.smtp.php mname this getparam mname cname this getparam cname email this getpar...
PHP傳送郵件功能實現
第一步 我用的是163郵箱傳送郵件,做乙個嘗試,在嘗試之前,需要要開啟163郵箱的授權碼如圖所示,請記住您的授權碼,將在之後的步驟中用到 第二步 第三步咱們該寫 了 html 對應的controller的php public functionchangepwd 傳送郵件來修改密碼 this disp...