asp实现在线发送邮件
基于ASP.NET和JMail组件构建网上电子邮件收发系统
接 收 邮件
发信 邮箱登 陆 的用户 名
myM i Ma S reP sWod=”1 3 5 ” / 设 J al i evras r . l 4 6 ;/ 2
置发信 邮箱登 陆 的密码
Absr c W ih t e d v lpme to o u e t r ,E- i swi ey u e t a t: t h e e o n fc mp trnewo ks mali d l s d,i s i c e sn l — ti n r a i gy be c me t idip n a l me ns f if r to ta s s i n AS o he n s e s b e a o no mai n r n miso . P.NET i a i o tnt a t o s n mp ra p r f.NET
J i c mp n n ,ta sc n c n t c ul u cin lo l eE- i s n iga d rc iigs s m. Mal o o e t h ti a o s u tafl fn t a ni mal e dn n e evn yt r y o n e Ke r s . ET;AS N y wo d : N P. ET;E— i;J i c mp n n ;IS mal Ma1 o o e t I
ma s d t o l t ma ls n i g, r c ii g,e c y to c u e o c mp ee i e dn e e vn n rp in,a d t e n h wo k o h l t r ta s s in. r f t e cuse r n miso Usng t e p we f e e e o me tf ncin o P. i h o rulW b d v l p n u to fAS NET a d t e ev n nd s n ngmalf n to f n her c ii g a e di i u c in o
百度文库-SAP发送邮件
采购订单发送邮件:截图如下:代码如下:ZMMR099:********************************************************************* ****Program name: ZMMR099**Description : PO SEND MAIL**Date/Autohr :********************************************************************* ***** M O D I F I C A T I O N L O G********************************************************************* ***** ChangeDate Programmer Request Description** ========== ========== ========== =========================*********************************************************************** ***REPORT ZMMR099NO STANDARD PAGE HEADINGLINE-SIZE 255LINE-COUNT 255.*** Global Data declearINCLUDE ZMMR099TOP.INCLUDE ZMMR099F01.*==================================================================== ==** Selection Screen Events*==================================================================== ==**** maintain selection screen outputAT SELECTION-SCREEN OUTPUT.*** F4 value help*AT SELECTION-SCREEN ON VALUE-REQUEST for <para/sel-opt>.*** check input dataAT SELECTION-SCREEN.*AT SELECTION-SCREEN ON <f>.*AT SELECTION-SCREEN ON BLOCK <>.****CHECK ON SELECT SCREEN INPUT*==================================================================== ==** Report Events*==================================================================== ==**** initial dataINITIALIZATION.clear: ADRNR2,SUPP_NAME2 ,SUPP_NAMECO ,SUPP_STR1 , "street2 SUPP_STR2 , "street3 SUPP_STREET,SUPP_CITY ,SUPP_CN ,SUPP_CN_NAME ,SUPP_ALL ,SUPP_FRISTNAME ,SUPP_LASTNAME ,SUPP_ANRED ,SUPP_PRSNR ,TEL_NUMBER ,TEL_EXTENS ,SUPP_TEL ,ADRNR ,DELV_NAME1 ,DELV_NAME2 ,DELV_STR1 ,DELV_STR2 ,DELV_STREET ,DELV_CITY ,DELV_CN ,DELV_CN_NAME ,DELV_FRISTNAME ,DELV_LASTNAME ,DELV_ANRED ,DELV_PRSNR ,TEL_NUMBER1 ,TEL_EXTENS1 ,DELV_TEL ,PUR_TOTAL ,TAX_TOTAL ,NET_TOTAL ,DEL_PLACE ,HEAD_LINE ,REMARK ,ITEM_LINE,TDNAME .*** prepare report dataSTART-OF-SELECTION."显示清单用于显示当前所抓取的所有的清单PERFORM SHOW_LIST.*** output reportEND-OF-SELECTION.*==================================================================== ==** List Events*==================================================================== ==**** page headerTOP-OF-PAGE.*** page header after first listTOP-OF-PAGE DURING LINE-SELECTION.*** page footerEND-OF-PAGE.*** when double clickAT LINE-SELECTION.*** when click some icon (function code)*at user-command.Include的代码如下:ZMMR099TOP:*&---------------------------------------------------------------------**& 包含 ZMMR099TOP*&---------------------------------------------------------------------*TABLES: EKKO , EKPO , NAST ,TNAPR.data XSCREEN(1) type C.data GS_PO_HEAER like ZMPO_HERDER.data GS_PO_HEAER1 like ZMPO_HERDER occurs 0 with header line .data: LT_ZPO_ITEM like ZMPO_ITEM occurs 0 with header line.data: GI_RETCODE type I,ADRNR2 type T001W-ADRNR,SUPP_NAME1 like ADRC-NAME1,SUPP_NAME2 like ADRC-NAME1,******************************************LIFNR like LFA1-LIFNR,UKURS like TCURR-UKURS,******************************************SUPP_NAMECO like ADRC-NAME_CO,SUPP_STR1 like ADRC-STR_SUPPL1,SUPP_STR2 like ADRC-STR_SUPPL1,SUPP_STREET like ADRC-STREET,SUPP_CITY like ADRC-CITY1,SUPP_CN like ADRC-COUNTRY,SUPP_CN_NAME like T005T-LANDX,SUPP_ALL type STRING,"SUPP_FRISTNAME like KNVK-NAMEV,SUPP_LASTNAME like KNVK-NAME1,SUPP_ANRED like KNVK-ANRED,SUPP_PRSNR like KNVK-PRSNR,TEL_NUMBER like ADR2-TEL_NUMBER,TEL_EXTENS like ADR2-TEL_EXTENS,FAX_NUMBER like ADRC-FAX_NUMBER,SUPP_TEL like KNVK-TELF1,ADRNR type T001W-ADRNR,KTOKK like LFA1-KTOKK,DELV_NAME1 like ADRC-NAME1,DELV_NAME2 like ADRC-NAME1,DELV_CO like ADRC-NAME_CO,DELV_STR1 like ADRC-STR_SUPPL1, "street2 DELV_STR2 like ADRC-STR_SUPPL1, "street3 DELV_STREET like ADRC-STREET,DELV_CITY like ADRC-CITY1,DELV_CN like ADRC-COUNTRY,DELV_CN_NAME like T005T-LANDX,DELV_FRISTNAME like KNVK-NAMEV,DELV_LASTNAME like KNVK-NAME1,DELV_ANRED like KNVK-ANRED,DELV_PRSNR like KNVK-PRSNR,TEL_NUMBER1 like ADR2-TEL_NUMBER,TEL_EXTENS1 like ADR2-TEL_EXTENS,DELV_TEL like KNVK-TELF1,PUR_TOTAL like EKPO-NETWR,TAX_TOTAL like EKPO-NETWR,NET_TOTAL like EKPO-NETWR,COM_PLACE like ADRC-STREET,DEL_PLACE like LFA1-STRAS,HEAD_LINE like TLINE occurs 0 with header line,REMARK like TLINE-TDLINE ,ITEM_LINE like TLINE occurs 0 with header line,TDNAME like RSTXT-TDNAME,GAP type C value ' ',GAP1 type C value '-',POMENGE1 like EKPO-MENGE,POMENGE2 like EKPO-MENGE.data:AUTH_BUKRS like EKKO-BUKRS.data: ITCURR like TCURR occurs 0 with header line. data I_GDATU like EKKO-BEDAT."sy-datum.data: BEGIN OF g_itab OCCURS 0,EBELN like ekko-ebeln,EKORG LIKE EKKO-EKORG,END OF g_itab.TYPE-POOLS: slis.*TYPES: BEGIN OF wa_EKKO,* mark type c,* ebeln TYPE EKKO-ebeln,* ekorg TYPE EKKO-ekorg,* ekgrp type ekko-ekgrp ,* bedat type ekko-bedat ,* lifnr type ekko-lifnr ,* BSART type EKKO-BSART ,* END OF wa_EKKO.*data: BEGIN OF it_EKKO OCCURS 0,mark type c,ebeln TYPE EKKO-ebeln,ekorg TYPE EKKO-ekorg,ekgrp type ekko-ekgrp ,bedat type ekko-bedat ,lifnr type ekko-lifnr ,BSART type EKKO-BSART ,END OF it_EKKO."DATA: it_EKKO TYPE TABLE OF wa_EKKO ,data:l_pos TYPE i VALUE 1.DATA: gt_fieldcat TYPE slis_t_fieldcat_alv,wa_fieldcat TYPE slis_fieldcat_alv.data gt_events TYPE slis_t_event.data: P_EBELN like ekko-ebeln.data: LS_JOB_INFO1 type SSFCRESCL.data :job_output_options TYPE ssfcresop.data: OBJBIN like SOLISTI1 occurs 10 with header line,DOCDATA like SODOCCHGI1,OBJTXT like SOLISTI1 occurs 10 with header line,OBJPACK like SOPCKLSTI1 occurs 1 with header line,RECLIST like SOMLRECI1 occurs 1 with header line,OBJHEAD like SOLISTI1 occurs 1 with header line.data: i_pdf_tab LIKE TABLE OF tline WITH HEADER LINE.data: g_filesize TYPE i.data: TAB_LINES type I.data: P_XSCRN TYPE c VALUE 'X'.SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.SELECT-OPTIONS: s_ebeln FOR ekko-ebeln ,s_ekorg FOR ekko-ekorg ,s_ekgrp FOR ekko-ekgrp ,s_bedat FOR ekko-bedat ,s_lifnr FOR ekko-lifnr ,S_BSART FOR EKKO-BSART ."parameters P_XSCRN as checkbox default 'X'.SELECTION-SCREEN END OF BLOCK b1.Include ZMMR099F01代码如下:*&---------------------------------------------------------------------**& 包含 ZMMR099F01*&---------------------------------------------------------------------*FORM entry_neu USING return_code us_screen.DATA: li_retcode TYPE sy-subrc.xscreen = us_screen.PERFORM processing USING us_screenCHANGING li_retcode.IF li_retcode NE 0.return_code = 1.ELSE.return_code = 0.ENDIF.ENDFORM. "entry_neu*&---------------------------------------------------------------------**& Form processing*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->PROC_SCREEN text* -->CF_RETCODE text*----------------------------------------------------------------------*FORM processing USING proc_screenCHANGING cf_retcode.DATA: lc_fm_name TYPE rs38l_fnam.DATA: ls_control_param TYPE ssfctrlop.DATA: ls_composer_param TYPE ssfcompop.DATA: lc_formname TYPE tdsfname.* Clear variantCLEAR gs_po_heaer.* SmartForm from customizing table TNAPRlc_formname = tnapr-sform.* select print dataPERFORM get_data CHANGING cf_retcode.READ TABLE gs_po_heaer1 INDEX 1.MOVE-CORRESPONDING gs_po_heaer1 TO gs_po_heaer.* delete adjacent duplicates from gs_po_header comparing eleln.IF cf_retcode = 0.PERFORM set_print_param CHANGING ls_control_paramls_composer_paramcf_retcode.ENDIF.IF cf_retcode = 0.* determine smartform function module for invoiceCALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'EXPORTINGformname = lc_formnameIMPORTINGfm_name = lc_fm_nameEXCEPTIONSno_form = 1no_function_module = 2OTHERS = 3.IF sy-subrc <> 0.* error handlingcf_retcode = sy-subrc.PERFORM protocol_update.ENDIF.ENDIF.CLEAR ls_job_info1.CALL FUNCTION lc_fm_namecontrol_parameters = ls_control_paramoutput_options = ls_composer_paramuser_settings = spacegs_po_heaer = gs_po_heaerpur_total = pur_totaltax_total = tax_totalnet_total = net_totaldel_place = del_placeremark = remarkIMPORTINGjob_output_info = ls_job_info1TABLESit_zpo_item = lt_zpo_item[]EXCEPTIONSformatting_error = 1internal_error = 2send_error = 3user_canceled = 4OTHERS = 5.* ls_control_param-no_open = 'X'.break abap01.IF sy-subrc <> 0.* error handlingcf_retcode = sy-subrc.PERFORM protocol_update.* get SmartForm protocoll and store it in the NAST protocoll PERFORM add_smfrm_prot.ENDIF.*ls_control_param-getotf = 'X'.ls_control_param-no_dialog = 'X'.ls_control_param-langu = sy-langu.CLEAR ls_job_info1.CALL FUNCTION lc_fm_namecontrol_parameters = ls_control_paramoutput_options = ls_composer_paramuser_settings = spacegs_po_heaer = gs_po_heaerpur_total = pur_totaltax_total = tax_totalnet_total = net_totaldel_place = del_placeremark = remarkIMPORTINGjob_output_info = ls_job_info1TABLESit_zpo_item = lt_zpo_item[]EXCEPTIONSformatting_error = 1internal_error = 2send_error = 3user_canceled = 4OTHERS = 5.PERFORM savapdf.CLEAR gs_po_heaer.ENDFORM. "PROCESSING*&---------------------------------------------------------------------**& Form set_print_param*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->CS_CONTROL_PARAM text* -->CS_COMPOSER_PARAM text* -->CF_RETCODE text*----------------------------------------------------------------------*FORM set_print_param CHANGING cs_control_param TYPE ssfctrlopcs_composer_param TYPE ssfcompopcf_retcode TYPE sy-subrc.DATA: ls_itcpo TYPE itcpo.DATA: lf_repid TYPE sy-repid.DATA: lf_device TYPE tddevice.cs_composer_param-tddest = 'LP01'.cs_composer_param-tdimmed = 'X'.IF xscreen = 'X'.cs_composer_param-tdnoprint = 'X'.ENDIF.cs_control_param-device = 'PRINTER'.* cs_control_param-device = 'MAIL'.cs_control_param-no_dialog = 'X'.cs_control_param-preview = xscreen.cs_control_param-langu = 'M'.ENDFORM. "set_print_param*&---------------------------------------------------------------------**& Form protocol_update*&---------------------------------------------------------------------** text*----------------------------------------------------------------------*FORM protocol_update .CHECK xscreen = space.CALL FUNCTION 'NAST_PROTOCOL_UPDATE'EXPORTINGmsg_arbgb = syst-msgidmsg_nr = syst-msgnomsg_ty = syst-msgtymsg_v1 = syst-msgv1msg_v2 = syst-msgv2msg_v3 = syst-msgv3msg_v4 = syst-msgv4EXCEPTIONSOTHERS = 1.ENDFORM. " protocol_update*&---------------------------------------------------------------------**& Form add_smfrm_prot*&---------------------------------------------------------------------** text*----------------------------------------------------------------------*FORM add_smfrm_prot .DATA: lt_errortab TYPE tsferror.FIELD-SYMBOLS: <fs_errortab> TYPE LINE OF tsferror.* get smart form protocollCALL FUNCTION 'SSF_READ_ERRORS'IMPORTINGerrortab = lt_errortab.* add smartform protocoll to nast protocollLOOP AT lt_errortab ASSIGNING <fs_errortab>.CALL FUNCTION 'NAST_PROTOCOL_UPDATE'EXPORTINGmsg_arbgb = <fs_errortab>-msgidmsg_nr = <fs_errortab>-msgnomsg_ty = <fs_errortab>-msgtymsg_v1 = <fs_errortab>-msgv1msg_v2 = <fs_errortab>-msgv2msg_v3 = <fs_errortab>-msgv3msg_v4 = <fs_errortab>-msgv4EXCEPTIONSOTHERS = 1.ENDLOOP.ENDFORM. " add_smfrm_prot*&---------------------------------------------------------------------**& Form protocol_update_spool*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->SYST_MSGNO text* -->P_LS_SPOOLID text* -->P_SPACE1 text* -->P_SPACE2 text* -->P_SPACE3 text*----------------------------------------------------------------------*FORM protocol_update_spool USING syst_msgnop_ls_spoolidp_space1p_space2p_space3.syst-msgid = 'ME'.syst-msgno = syst_msgno.syst-msgv1 = p_ls_spoolid.CONDENSE syst-msgv1.CHECK xscreen = space.CALL FUNCTION 'NAST_PROTOCOL_UPDATE'EXPORTINGmsg_arbgb = syst-msgidmsg_nr = syst-msgnomsg_ty = syst-msgtymsg_v1 = syst-msgv1msg_v2 = p_space1msg_v3 = p_space2msg_v4 = p_space3EXCEPTIONSOTHERS = 1.ENDFORM. " protocol_update_spool*&---------------------------------------------------------------------**& Form get_data*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->CF_RETCODE text*----------------------------------------------------------------------*FORM get_data CHANGING cf_retcode.DATA lv_ebeln LIKE ekko-ebeln.DATA: cnt(2) TYPE c,persno(10) TYPE c.IF nast-objky+10 NE space.nast-objky = nast-objky+16(10).ELSE.nast-objky = nast-objky.ENDIF.lv_ebeln = nast-objky.SELECT DISTINCT ekko~bukrs ekko~lifnr ekko~ebeln ekko~bsart ekko~ae datekko~inco1 ekko~inco2 ekpo~werks ekko~waers ekko~frgzu ekko~ ztermekko~ernam ekko~bedat ekko~ekorg ekko~ekgrp ekko~wkurs"汇率INTO CORRESPONDING FIELDS OF TABLE gs_po_heaer1FROM ekkoJOIN ekpo ON ekpo~ebeln = ekko~ebelnWHERE ekko~ebeln = lv_ebeln.LOOP AT gs_po_heaer1.SELECT SINGLE lgort INTO gs_po_heaer1-lgort FROM ekpo WHERE ekpo~ ebeln = gs_po_heaer1-ebeln.SELECT SINGLE bednr INTO gs_po_heaer1-bednr FROM eban WHERE eban~ ebeln = gs_po_heaer1-ebeln.SELECT SINGLE afnam INTO gs_po_heaer1-afnam FROM eban WHERE eban~ ebeln = gs_po_heaer1-ebeln.********************************************************************* ************************************SELECT SINGLE ukurs INTO gs_po_heaer1-ukurs FROM tcurr WHERE tcu rr~kurst EQ 'M'AND fcurr EQ 'USD' "从货币AND tcurr EQ gs_po_heaer1-waers "最终货币AND tcurr~gdatu <= gs_po_heaer1-bedatAND gdatu > i_gdatu.* *******************************IF gs_po_heaer1-bukrs = 1000.gs_po_heaer1-ztitel = '香港天惠有限公司'.ELSEIF gs_po_heaer1-bukrs = 3000.gs_po_heaer1-ztitel = '东莞添威电子制品有限公司'.ENDIF.**************************************************************************************************** *************************************MODIFY gs_po_heaer1.ENDLOOP.SELECT ekpo~ebeln ekpo~ebelp ekpo~matnr ekpo~ematn ekpo~txz01ekpo~menge ekpo~meins ekpo~netpr ekko~waers ekko~bsartekpo~netwr ekpo~peinh ekpo~mwskz ekpo~infnr ekpo~werksekpo~bukrs ekpo~bprme ekpo~bpumz ekpo~bpumn ekpo~zzsub_matnr ekpo~banfn ekpo~bednr ekpo~loekz ekpo~idnlf ekpo~zzdeudate* "EKET~MENGE EKET~EINDT* ekpo~umren ekpo~umrez ekpo~lmeinINTO CORRESPONDING FIELDS OF TABLE lt_zpo_itemFROM ekpoJOIN ekko ON ekpo~ebeln = ekko~ebeln* JOIN EKET ON EKET~EBELN = EKPO~EBELN AND EKET~EBELP = EKPO~EBELP WHERE ekpo~ebeln = lv_ebeln .* AND ekpo~loekz <> 'L'.CLEAR pur_total.CLEAR tax_total.CLEAR net_total.DESCRIBE TABLE lt_zpo_item LINES sy-tmaxl.IF sy-tmaxl = 0.MESSAGE i004(zmseg).STOP.ENDIF.LOOP AT lt_zpo_item.************************添加物料版次DATA: max_aennr(12) TYPE c.SELECT MAX( aeoi~aennr ) INTO max_aennr FROM aeoi WHERE aeoi~oitx t = '修改版本' AND aeoi~objkt = lt_zpo_item-matnr.SELECT SINGLE aeoi~revlv INTO lt_zpo_item-revlv FROM aeoi WHERE aeoi~aennr = max_aennr.******************************************CLEAR lt_zpo_item-atwrt. CLEAR lt_zpo_item-atwrt2. CLEAR lt _zpo_item-atwrt3.CLEAR lt_zpo_item-ematn. CLEAR lt_zpo_item-ematn2.IF lt_zpo_item-loekz = 'L'.lt_zpo_item-menge = 0.ENDIF.IF lt_zpo_item-zzsub_matnr = ''.SELECT SINGLE atwrt INTO lt_zpo_item-atwrtFROM auspWHERE objek = lt_zpo_item-matnrAND atinn = '0000000008'AND atwrt <> ''.SELECT SINGLE atwrt INTO lt_zpo_item-atwrt2FROM auspWHERE objek = lt_zpo_item-matnrAND atinn = '0000000034'AND atwrt <> ''.CONCATENATE lt_zpo_item-atwrt lt_zpo_item-atwrt2 INTO lt_zpo_it em-ematn2.* IF sy-subrc = 0.* lt_zpo_item-ematn = lt_zpo_item-atwrt.* ENDIF.CLEAR lt_zpo_item-atwrt.SELECT SINGLE atwrt INTO lt_zpo_item-atwrt3FROM auspWHERE objek = lt_zpo_item-matnrAND atinn = '0000000009'AND atwrt <> ''.IF sy-subrc = 0.CONCATENATE lt_zpo_item-atwrt3 ':' lt_zpo_item-ematn2 INTO l t_zpo_item-ematn2.ENDIF.ELSE.SELECT SINGLE atwrt INTO lt_zpo_item-atwrtFROM auspWHERE objek = lt_zpo_item-zzsub_matnrAND atinn = '0000000008'AND atwrt <> ''.SELECT SINGLE atwrt INTO lt_zpo_item-atwrt2FROM auspWHERE objek = lt_zpo_item-zzsub_matnrAND atinn = '0000000034'AND atwrt <> ''.CONCATENATE lt_zpo_item-atwrt lt_zpo_item-atwrt2 INTO lt_zpo_it em-ematn2.* IF sy-subrc = 0.* lt_zpo_item-ematn = lt_zpo_item-atwrt.* ENDIF.CLEAR lt_zpo_item-atwrt.SELECT SINGLE atwrt INTO lt_zpo_item-atwrt3FROM auspWHERE objek = lt_zpo_item-zzsub_matnrAND atinn = '0000000009'AND atwrt <> ''.IF sy-subrc = 0.CONCATENATE lt_zpo_item-atwrt3 ':' lt_zpo_item-ematn2 INTO l t_zpo_item-ematn2.ENDIF.ENDIF.SELECT SINGLE zeivr INTO lt_zpo_item-zeivrFROM maraWHERE matnr = lt_zpo_item-matnr.*when the currency is JPY,IF lt_zpo_item-waers = 'JPY'.lt_zpo_item-netpr = lt_zpo_item-netpr * 100.ENDIF.*when the currency is JPYCLEAR: pomenge1,pomenge2.SELECT b~maktx a~mfrpn a~wrkstINTO (lt_zpo_item-maktx,lt_zpo_item-mfrpn,lt_zpo_item-wrkst)FROM mara AS aJOIN makt AS b ON a~matnr = b~matnrWHERE a~matnr = lt_zpo_item-ematn.ENDSELECT.IF lt_zpo_item-peinh <> 0.lt_zpo_item-netpr = lt_zpo_item-netpr / lt_zpo_item-peinh.ENDIF.CLEAR:pomenge1,pomenge2.pomenge1 = lt_zpo_item-menge.IF frac( pomenge1 ) <> 0.lt_zpo_item-menge1 = pomenge1 .ELSE.lt_zpo_item-menge1 = trunc( pomenge1 ).ENDIF.pomenge2 = lt_zpo_item-menge * lt_zpo_item-bpumz / lt_zpo_item-bpumn.lt_zpo_item-netwr = pomenge2 * lt_zpo_item-netpr.IF frac( pomenge2 ) <> 0.lt_zpo_item-menge2 = pomenge2 .ELSE.lt_zpo_item-menge2 = trunc( pomenge2 ).ENDIF.lt_zpo_item-netpr1 = lt_zpo_item-netpr.lt_zpo_item-netwr1 = lt_zpo_item-netwr.CONDENSE lt_zpo_item-menge1.CONDENSE lt_zpo_item-menge2.CONDENSE lt_zpo_item-netpr1.CONDENSE lt_zpo_item-netwr1.CLEAR lt_zpo_item-item_tax.IF lt_zpo_item-mwskz = 'J0' OR lt_zpo_item-mwskz = 'Y0' OR lt_zpo _item-mwskz = 'Z0'.lt_zpo_item-item_tax = lt_zpo_item-netwr * 0.ENDIF.IF lt_zpo_item-mwskz = 'J1' OR lt_zpo_item-mwskz = 'Y1' OR lt_zpo _item-mwskz = 'Z1'.lt_zpo_item-tax_code = '17%'.lt_zpo_item-item_tax = lt_zpo_item-netwr * 17 / 100.ENDIF.IF lt_zpo_item-mwskz = 'J2' OR lt_zpo_item-mwskz = 'Z2'.lt_zpo_item-tax_code = '11%'.lt_zpo_item-item_tax = lt_zpo_item-netwr * 11 / 100.ENDIF.IF lt_zpo_item-mwskz = 'J3' OR lt_zpo_item-mwskz = 'Z3'.lt_zpo_item-tax_code = '7%'.lt_zpo_item-item_tax = lt_zpo_item-netwr * 7 / 100.ENDIF.IF lt_zpo_item-mwskz = 'J4' OR lt_zpo_item-mwskz = 'Z4'.lt_zpo_item-tax_code = '6%'.lt_zpo_item-item_tax = lt_zpo_item-netwr * 6 / 100.ENDIF.IF lt_zpo_item-mwskz = 'J5'.lt_zpo_item-tax_code = '4%'.lt_zpo_item-item_tax = lt_zpo_item-netwr * 4 / 100.ENDIF.IF lt_zpo_item-mwskz = 'Z5'.lt_zpo_item-tax_code = '3%'.lt_zpo_item-item_tax = lt_zpo_item-netwr * 3 / 100.ENDIF.lt_zpo_item-item_tax1 = lt_zpo_item-item_tax.lt_zpo_item-item_total = lt_zpo_item-item_tax + lt_zpo_item-netwr.CONDENSE lt_zpo_item-item_tax1.tax_total = tax_total + lt_zpo_item-item_tax.net_total = net_total + lt_zpo_item-netwr.pur_total = net_total + tax_total.*get po info textCLEAR tdname.* CONCATENATE LT_ZPO_ITEM-INFNR LT_ZPO_ITEM-BUKRS '0'* INTO TDNAME. " LT_ZPO_ITEM-WERKSCONCATENATE lt_zpo_item-ebeln lt_zpo_item-ebelpINTO tdname. " LT_ZPO_ITEM-WERKSCALL FUNCTION 'READ_TEXT'EXPORTINGclient = sy-mandtid = 'F01'language = '1'name = tdnameobject = 'EKPO'* ARCHIVE_HANDLE = 0* LOCAL_CAT = ' '* IMPORTING* HEADER =TABLESlines = item_lineEXCEPTIONSid = 1language = 2name = 3not_found = 4object = 5reference_check = 6wrong_access_to_archive = 7OTHERS = 8 .IF sy-subrc = 0.LOOP AT item_line.CONCATENATE lt_zpo_item-itemtext item_line-tdline INTOlt_zpo_item-itemtext.ENDLOOP.CLEAR item_line.ENDIF.IF lt_zpo_item-itemtext IS NOT INITIAL.CONCATENATE 'Remark: ' lt_zpo_item-itemtext INTO lt_zpo_item-itemtext.ENDIF.SELECT SINGLE eindt INTO lt_zpo_item-eindtFROM eket WHERE ebeln = lt_zpo_item-ebelnAND ebelp = lt_zpo_item-ebelp.********************************修改再计划日期为交货日期IF lt_zpo_item-zzdeudate IS NOT INITIAL.lt_zpo_item-eindt = lt_zpo_item-zzdeudate.ENDIF.PERFORM delete_zero USING lt_zpo_item-ebelp.MODIFY lt_zpo_item.CLEAR lt_zpo_item.ENDLOOP.LOOP AT gs_po_heaer1.*&gain header texttdname = gs_po_heaer1-ebeln.CALL FUNCTION 'READ_TEXT'EXPORTING* CLIENT = SY-MANDTid = 'F01'language = sy-languname = tdnameobject = 'EKKO'* ARCHIVE_HANDLE = 0* LOCAL_CAT = ' '* IMPORTING* HEADER =* OLD_LINE_COUNTER =TABLESlines = item_line EXCEPTIONSid = 1language = 2name = 3not_found = 4object = 5reference_check = 6wrong_access_to_archive = 7OTHERS = 8.IF sy-subrc = 0.READ TABLE item_line INDEX 1.MOVE item_line-tdline TO gs_po_heaer1-mrpno.ENDIF.SELECT SINGLE eknam smtp_addrINTO (gs_po_heaer1-eknam,gs_po_heaer1-smtp_addr2)FROM t024WHERE ekgrp = gs_po_heaer1-ekgrp.SELECT adrnrINTO adrnr2FROM t001wWHERE werks = gs_po_heaer1-werks.IF sy-subrc = 0.SELECT streetINTO gs_po_heaer1-addressFROM adrcWHERE addrnumber = adrnr2.ENDSELECT.ENDIF.ENDSELECT.SELECT adrnrINTO adrnrFROM lfa1WHERE lifnr = gs_po_heaer1-lifnr.ENDSELECT.SELECT name1 name2 city1 name_co str_suppl1 str_suppl2 country street tel_number fax_numberINTO (supp_name1,supp_name2,supp_city,supp_nameco,supp_str1, supp_str2,supp_cn,supp_street,tel_number,fax_number) FROM adrcWHERE addrnumber = adrnr.ENDSELECT.SELECT landxINTO supp_cn_nameFROM t005tWHERE spras = 'E'AND land1 = supp_cn.ENDSELECT.CONDENSE supp_name1.CONDENSE supp_name2.gs_po_heaer1-supp_co = supp_nameco.gs_po_heaer1-supp_strone = supp_str1.gs_po_heaer1-supp_strtwo = supp_str2.gs_po_heaer1-supp_tel = tel_number.gs_po_heaer1-supp_fax = fax_number.gs_po_heaer1-address = supp_street.CONCATENATE supp_street supp_city supp_cn_nameINTO gs_po_heaer1-supp_cn SEPARATED BY gap .CONCATENATE supp_name1 supp_name2 INTO gs_po_heaer1-supp_name SEPARATED BY gap.SELECT SINGLE namev name1 anred prsnrINTO (supp_fristname,supp_lastname,supp_anred,supp_prsnr)FROM knvkWHERE lifnr = gs_po_heaer1-lifnr.CONCATENATE supp_lastname supp_fristname INTO gs_po_heaer1-supp_c ontact.SELECT SINGLE koinh INTO gs_po_heaer1-koinh FROM lfbk WHERE lifnr = gs_po_heaer1-lifnr.SELECT SINGLE smtp_addr INTO gs_po_heaer1-smtp_addr1FROM adr6 WHERE addrnumber = adrnr.SELECT SINGLE text1INTO gs_po_heaer1-text1FROM t052uWHERE zterm = gs_po_heaer1-zterm.IF gs_po_heaer1-inco1 = space.SELECT SINGLE inco1 inco2INTO (gs_po_heaer1-inco1,gs_po_heaer1-inco2)FROM lfm1WHERE lifnr = gs_po_heaer1-lifnrAND ekorg = gs_po_heaer1-ekorg.ELSE.SELECT SINGLE bezei INTO gs_po_heaer1-inco2FROM tinctWHERE inco1 = gs_po_heaer1-inco1AND spras = '1'.ENDIF.CLEAR persno.SELECT SINGLE persnumber INTO persnoFROM user_addrpWHERE bname = gs_po_heaer1-ernam.IF sy-subrc = 0 AND gs_po_heaer1-smtp_addr2 = space.SELECT SINGLE smtp_addr INTO gs_po_heaer1-smtp_addr2FROM adr6WHERE persnumber = persno.ENDIF.CLEAR lt_zpo_item.READ TABLE lt_zpo_item WITH KEY ebeln = gs_po_heaer1-ebeln.IF sy-subrc = 0.gs_po_heaer1-banfn = lt_zpo_item-banfn.IF lt_zpo_item-tax_code NE space.CONCATENATE '(VAT' lt_zpo_item-tax_code ')' INTO gs_po_heaer1 -taxcode.ENDIF.ENDIF.CLEAR cnt.*************采购单版本DATA:BEGIN OF tcdpos,changenr LIKE cdpos-changenr,END OF tcdpos.DATA:it_cdpos LIKE tcdpos OCCURS 0 WITH HEADER LINE.SELECT changenr INTO CORRESPONDING FIELDS OF TABLE it_cdpos FROM cdposWHERE objectid = gs_po_heaer1-ebeln AND tabname = 'EKPO' AND ( fname = 'MENGE' OR fname = 'NETWR' OR fname = 'KEY' OR fname = 'LO EKZ' )."SELECT COUNT(*) INTO cnt FROM cdpos WHERE objectid = gs_po_heae r1-ebeln AND tabname = 'EKPO' AND ( fname = 'MENGE' OR fname = 'NET WR' ).DELETE ADJACENT DUPLICATES FROM it_cdpos .cnt = lines( it_cdpos ).CONCATENATE 'Rev.' ' ' cnt INTO gs_po_heaer1-count.MODIFY gs_po_heaer1.CLEAR gs_po_heaer1.ENDLOOP.ENDFORM. "get_data*&---------------------------------------------------------------------**& Form delete_zero*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** -->P_P1 text*----------------------------------------------------------------------*FORM delete_zero USING p_p1.CALL FUNCTION 'BKK_DELETE_LEADING_ZERO'CHANGINGc_field = p_p1.ENDFORM. " delete_zero*&---------------------------------------------------------------------**& Form SHOW_LIST*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* <-- p2 text*----------------------------------------------------------------------*FORM show_list .SELECT ebeln ekorg ekgrp bedat lifnr FROM ekkoINTO CORRESPONDING FIELDS OF TABLE it_ekkoWHERE ebeln IN s_ebeln。
如何在网页中实现自动发送电子邮件功能
如何在网页中实现自动发送电子邮件功能
如何在网页中实现自动发送电子邮件功能
作者:周洁
重庆市总工会微机室
邮件列表(mailing list)是电子邮件的扩展应用之一,被广泛应用于用户的跟踪服务,发布产品信息,以及电子报刊等方面。
用户可以向相应的邮件服务器发送一份订阅申请邮件,这样该用户就被加入到该邮件发送的列表中。
其过程是:用户填写相关申请订阅信息,系统根据用户提供的邮箱地址发送一封确认邮件,并要求用户打开自己的邮箱,点击邮件相关确认部份将其的确认信息发送给网站的Webmaster,Webmaster在得到确认信息后向用户开通相关的服务。
那么这种自动发送邮件的功能是怎样实现的,我们怎样在自己网站中实现该功能呢?下面将对此实现方法进行阐述。
软件厂商提供了方便、简易、与服务器无关且稳固的方法,使我们可以在页面上用一些ASP组件直接发送邮件。
如:Microsoft提供的CDONTS
第 1 页共 1 页。
如何使用VBA实现自动化邮件发送
如何使用VBA实现自动化邮件发送自动化邮件发送是一项广泛应用于企业和个人工作中的任务。
VBA (Visual Basic for Applications)是一种用于自定义Microsoft Office应用程序的编程语言,它可以帮助我们实现自动化邮件发送的功能。
本文将介绍如何使用VBA编写自动化邮件发送的代码,并实现发送给多个收件人、附件添加等功能。
首先,我们需要打开Microsoft Outlook应用程序,并创建一个新的邮件。
通过以下VBA代码实现:```VBASub SendMail()Dim OutlookApp As Outlook.ApplicationDim MailItem As Outlook.MailItem'启动Outlook应用程序Set OutlookApp = New Outlook.Application'创建新邮件Set MailItem = OutlookApp.CreateItem(olMailItem)With MailItem'设置收件人.To = "收件人邮箱地址"'设置抄送.CC = "抄送人邮箱地址"'设置密送.BCC = "密送人邮箱地址"'设置主题.Subject = "邮件主题"'设置邮件内容.Body = "邮件内容"'添加附件.Attachments.Add "附件路径" '发送邮件.SendEnd With'释放对象Set OutlookApp = NothingSet MailItem = Nothing'显示提示信息MsgBox "邮件发送成功!"End Sub```在上述代码中,我们首先创建了一个Outlook应用程序对象`OutlookApp`和一个邮件对象`MailItem`。
如何在网页中实现自动发送电子邮件功能
如何在网页中实现自动发送电子邮件功能作者:周洁重庆市总工会微机室邮件列表(mailing list)是电子邮件的扩展应用之一,被广泛应用于用户的跟踪服务,发布产品信息,以及电子报刊等方面。
用户可以向相应的邮件服务器发送一份订阅申请邮件,这样该用户就被加入到该邮件发送的列表中。
其过程是:用户填写相关申请订阅信息,系统根据用户提供的邮箱地址发送一封确认邮件,并要求用户打开自己的邮箱,点击邮件相关确认部份将其的确认信息发送给网站的Webmaster,Webmaster在得到确认信息后向用户开通相关的服务。
那么这种自动发送邮件的功能是怎样实现的,我们怎样在自己网站中实现该功能呢?下面将对此实现方法进行阐述。
软件厂商提供了方便、简易、与服务器无关且稳固的方法,使我们可以在页面上用一些ASP组件直接发送邮件。
如:Microsoft提供的CDONTS及第三方组件Jmail、ASPFreeMail,FastMail,ASPEmail,ASPQEmail等。
1.CDONTS(collaboration Data Object for NT Server)CDONTS与ADO类似,它们为用户提供了用任何程序和脚本语言访问操作系统复杂和稳固的功能集合的能力。
编程人员通过以ActiveX封装Windows的本地消息服务来收发电子邮件。
Windows2000中会默认安装SMTP服务,Windows NT中可用Windows NT4.0 option pack 4安装SMTP服务。
安装后CDONTS.DLL存放在C:\Winnt\System32\目录下面。
有了该组件我们还不能立即应用它,在对它进行使用之前我们必须先完成组件的注册,我们可以在MS-DOS方式下进入到CDONTS.DLL所在的目录C:\Winnt\System32\下输入:c:\winnt\system32>regsvr32 cdonts.dll(如果我们想将其御载可用指令: c:\winnt\system32>regsvr32/u cdonts.dll)通过CDONTS发送电子邮件非常方便,仅需创建一个邮件对象并设置其几个相关属性便可实现。
用ASP.NET自制Email发送系统
‘ 设定邮件的抄送地址 f E al ct t > te i b . c E i c m i . x < h n Ma O jC ma C . C e l l
t xt e
<p >
< >请输入 邮件密送地址 : > b </ b
<p >
‘ 定邮件格 式是文本格式, 设 如果要设定成超 文本 , 把
Ma1oma. e t 成 Ma F r a . t i r tT x 改 F l i o m /H ml Ma O jB d F r t Ma oma. e t i b . o y oma — l r tT x
<b >
<s— c p£l 掘g =” b a n e v “n珊a =“缸 v r > t e¨
,
校
遗
z 疆 广 、
E -malmt@ sn o i : g ia t m
= ‘a eS o E li’r r t ‘e v r 、 n le p d n al u  ̄ =’ r e ‘ S ’ 3 P s E c y e Mu f a t F r 一 1 =” o t n T p =” l p r/ o m “ e v r > s re“
S b S nd t o u e Bu t n
~
Ciksn e sO jc,ea l (ed ra bet s c
E  ̄ t g) va Ars
AS NE P. T来 发 送 E -ma </ 2 l f h >
‘ 刨立- /Ma Mesg - b i sa e对象 l Dm i b sNe Ma Mesg ( i Na O ja w i sa e) l L 以下是设定 Ma Mesg i sa e对象 的属性 , l 及程序的一 些常规判断。 设定邮件的发送地址
asp发邮件代码
objMail.To="recipient@"
objMail.Subject="subject"
objMail.TextBody="body"
objMail.Send
%>
emailbady="<font size=3>资料:</font><br>"
Const cdoSMTPServerPort="/cdo/configuration/smtpserverport"
Const cdoSMTPC
Const cdoSMTPAuthenticate="/cdo/configuration/smtpauthenticate"
rs("regtime")=DateAdd("h", 15, now())----
2.使用CDO发送邮件
注:CDO和CDOSYS在iis6和IIS7环境下均可使用引用:
<%
sendUrl="/cdo/configuration/sendusing"
Set objMail=CreateObject("CDO.Message")
' Use the config object created above
Set objMail.Configuration=objConfig
objMail.From="sender@"
SendEmailState = 2 'Failure
如何在ASP.NET中发送电子邮件?
如何在中发送电子邮件?例一:input.htm<html><head><title>精彩春风之发送HTML格式邮件</title></head><body><form method="post" name="form1" action="emailhtml2.aspx">邮件地址:<input type="text" name="EmailAddress" size="30"value="song@"><br><br><input type="submit" value="发送" name="b1"></form></body></html>sendemail.asp<%@ Import Namespace="System.Web.Util" %><script language="VB" runat=server>Sub Page_load(Sender as Object, E as EventArgs)Dim MyMessage as New MailMessageMyMessage.To = request.form("EmailAddress")MyMessage.From = "随风起舞"MyMessage.Subject = "精彩春风之芊芊祝福!"MyMessage.BodyFormat = MailFormat.Html` 增加BodyFormat, 发送格式化的HTML,并删除这行和在message.的HTML代码,作为常规文本发送MyMessage.Body = "<html><body><h1>您收到的邮件来自随风起舞!<ahref=''></h1></body></html>"SmtpMail.Send(MyMessage)End Sub</script><html><head><title>精彩春风之发送HTML格式邮件</title></head><body>恭喜,你已发送了HTML 格式的邮件到:<br><h1><% response.write(request.form("EmailAddress")) %></h1></body></html>例二:<% @Page Language="C#" %><% @Import Namespace="System.Web.Util" %><%MailMessage msgMail = new MailMessage();msgMail.To = "liyanbing@ "; = "songyanhao@";msgMail.From = "feiwenhua@ ";msgMail.Subject = "闪亮日子之发送HTML格式的邮件"; msgMail.BodyFormat = MailFormat.Html;string strBody = "<html><body><b>闪亮日子</b>" +" <font color=\"red\">春风精彩</font></body></html>"; msgMail.Body = strBody;SmtpMail.Send(msgMail);Response.Write("恭喜,发送成功!");%>例三:<% @Page Language="C#" %><% @Import Namespace="System.Web.Util" %><%string strTo = "songyanhao@";string strFrom = "feiwenhua@";string strSubject = "闪亮日子之发送简单的邮件"; SmtpMail.Send(strFrom, strTo, strSubject,"春风精彩之文本文件"); Response.Write("恭喜,发送成功!");%>例四:<% @Page Language="C#" %><% @Import Namespace="System.Web.Util" %><%MailMessage msgMail = new MailMessage();msgMail.To = "sunchunliang@ ";msgMail.From = "wuxiaotao@ ";msgMail.Subject = "闪亮日子之发送带附件的邮件";msgMail.BodyFormat = MailFormat.Text;msgMail.Body = "闪亮日子之春风精彩!";msgMail.Attachments.Add(new MailAttachment("c:\\shanliangrizi\\jingcaitxt")); SmtpMail.Send(msgMail);Response.Write("恭喜,发送成功!");%>例五:我们来使用.Net FrameWork SDK中的一个关于电子邮件发送的Class Library(类库)System.Web.Mail完成邮件发送。
发送邮件(SendEmail)
发送邮件(SendEmail)
我们开发的⽹站,也许会少不了发送邮件的功能。
在中的发送邮件的组件功能对我们实现的功能,基本上没有什么问题了。
第⼀部分:⼀个⽹站中,也许不⽌⽤⼀个邮箱来发送各类的电⼦邮件,如电⼦报,⼴告,报表或是⼀些⽤户请求的邮件。
所以得⽤⼀个数据表来存储这些发送邮件的参数。
当我们需要批量发送邮件时,再加上邮件服务器不是⾃⼰的时候,如果利⽤CPU处理的速度结全程序中for...或while⽅法进⾏发送,邮件服务器也许错把发送的邮件当⽤是⼴告或是垃圾邮件来处理。
所以得把发送的邮件先存⼊⼀个邮件列表中,然后我们需要控制台程序或线程⽅法对邮件列表的邮件相隔⼀段时间来发送。
⽂件格式:.wmv;⼤⼩:16,802KB;长度:00:16:22。
第⼆部分:在程序中开发好邮件列表或是邮件参数的类别,以及数据库中相关的存储过程。
⽂件格式:.wmv;⼤⼩:29,873KB;长度:00:27:55。
第三部分:开发线程类别,如何处理每隔⼀段时间来分发邮件列表的邮件。
⽂件格式:.wmv;⼤⼩:41,775KB;长度:00:34:39。
ASP.NET邮件发送技术的设计与实现
目 的 邮 件 地 址 o j i sa e S be t “ bMal sg . u jc- 测试 邮件主 Me
题 : 好 !” / 你 ; /发送 邮 件 的 标 题
o j i sa e Bo y “ bMal s g , d = 邮件内 容 : Me 这 是 一 封 测 试 邮件 !” /发 送 邮 件的 内容 ;/
维普资讯
Q !ห้องสมุดไป่ตู้:
Sci ce nd en a Tech nol ogy n l nova on ti He al r d
AS N P. T邮件 发送技 术的设计 与实现 E
王 向 华 ( 津职 业大学电子信息工程学 院 天津 3 0 0 ) 天 0 4 2 摘 要 : coot 司推 出Viu l tdo N T后 , 些以前使 用 A P开发 WE Mirsf 公 s a Su i, E 一 S B应 用程序 的程序 员, 正在 由 AS P转 向 A P. T平 台递送 邮 S NE 件 。本 文 阐述 了利 用 A P, T和 S P协 议 开 发 邮 件 发 送 系统 的主 要 方 法 。 S NE MT 关键词 : P. T 邮件发送 系统 屯子 商务 S P协议 AS NE MT 中图分类号 : P T 3 文献标识码 : A 文章编号 : 6 4 0 ( o 8 0 () 5 0 1 — 9 x z 0 ) 6 b一0 3 - 2 7 8 C I
一 一
Mal s a e对 象 的属性 如 下 : o i Me s g Fr m: 发 送 邮 件 的 地 址 ; o: 受 邮 件 的 地 址 ; T 接 S be t 邮件 的标题 ; ro i : uj : c P i r y 邮件 的优 先 t 级 ( 效 值 为 Hi 有 gh, Low , 1 a ) Nor7 1 ; 1 Ata h n s 返 回一 个 集 合 , t c me t : 代表 附 件 ; B c 密 送地 址 ; c 抄送地 址 ; o y: c: C : B d 获取 或 是设 置 电子 邮件 消息 的 内容 ; o y o ma : BdF r t 获 取 或是 设 置 Ma l o ma 的枚 举 值 , 值 i r t F 此 指 定 消 息 体 邮件 的 格 式 ( ml 式 、T x Ht 格 et 格 式 )B d e c d n : 定消 息的编 码方 式 ; o y n o ig 指 编码( 主要 有 Ba e 4, s 6 UUe c d ) n o e 发送 邮 件 : mt Mal S p i 类的 S n e d方 法用 干 发送 邮 件 , 两 个 重 载 方 法 。 有 S p i. e d “ 送 邮件 的 地 址 ” mt Ma lS n (发 , “ 受 邮 件 的地 址 ” “ 件 的标 题 ” “ 接 ,邮 , 邮件 消 息 的 内容 ” , 个 方 法 很 简 单 , 适 合 发 )这 不 送 带 附 件 的 邮 件 。 2) 7 t ( S1 PM a . nd 1 n Se ( i s a e : 方法 复杂 、灵活 , 合 发 Ma l s g ) 此 Me 适 送附 件 , 而且 可 以设 置 Mal sa e对象 的 iMe s g 各种属性 值 。
SAP邮件发送
SAP邮件发送此邮件发送为附件XLS⽂档,也可将参数设置为PDF,可发送PDF附件。
⼀、新建⾃定义表,如下: 存储邮箱地址。
若邮箱地址可直接从系统抓取则可忽略⼆、数据定义****-----------------------------------邮件发送---------------------------------------------CONSTANTS:gc_tab TYPE c VALUE cl_bcs_convert=>gc_tab, "CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TABgc_crlf TYPE c VALUE cl_bcs_convert=>gc_crlf. "CL_ABAP_CHAR_UTILITIES=>CR_LFDATA: i_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,i_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE, "receiversi_sendmail LIKE zsendmail OCCURS 0 WITH HEADER LINE,i_contents_txt LIKE solisti1 OCCURS 0 WITH HEADER LINE, "ASCII contents of object and attachments i_contents_hex LIKE solix OCCURS 0 WITH HEADER LINE, "Binary contents of object and attachments i_contents_bin LIKE solisti1 OCCURS 0 WITH HEADER LINE,i_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE, "attachments namew_doc_data LIKE sodocchgi1.DATA: c_mimetype TYPE char64 VALUE 'APPLICATION/MSEXCEL;charset=utf-16le'.DATA: v_xattach TYPE xstring.DATA: lv_string TYPE string.DATA: tab_lines LIKE sy-tabix,w_sent_all(1) TYPE c,w_error TYPE sy-subrc.DATA:num1 TYPE i.三、相关代码START-OF-SELECTION.PERFORM getdata.DESCRIBE TABLE gt_data LINES num1.IF num1 NE 0.IF sy-batch = 'X'.PERFORM send_mail.ELSE.PERFORM display_data.ENDIF.ENDIF.IF num1 EQ 0.MESSAGE '没有符合条件的数据 ' TYPE 'I'.ENDIF.FORM send_mail .PERFORM get_send_mail.***define mail main context****PERFORM define_mail_header.***dfine attachment*******************PERFORM define_mail_attachment.***get mail receiver*****************PERFORM get_receivers.*Send email message, although is not sent from SAP until mail send*program has been executed(rsconn01)PERFORM send_email_message.ENDFORM.FORM get_send_mail.SELECT * FROM zsendmailINTO CORRESPONDING FIELDS OF TABLE i_sendmail.IF matnr[] IS INITIAL .DELETE i_sendmail WHERE ztype NE '1'."成品ELSE.DELETE i_sendmail WHERE ztype NE '2'."复配料ENDIF.ENDFORM. " GET_SPFLI_DATAFORM define_mail_header .DATA: tmp_date LIKE sy-datum.DATA: tmp_char(30).tmp_date = sy-datum.CONCATENATE 'Overdue Batch ' sy-datum INTO tmp_char.********define subject and priority************IF matnr[] IS INITIAL.w_doc_data-obj_descr = '成品库存货龄表'. "Email Subject.ELSE.w_doc_data-obj_descr = '复配料库存货龄表'. "Email Subject.ENDIF.w_doc_data-priority = 1. "mail PRIORITY¡A 1 is highestw_doc_data-obj_langu = sy-langu.w_doc_data-obj_name = 'OFFER'. "Name of document..w_doc_data-sensitivty = 'O'. "Document sensitivity.********mail main context***********************i_contents_txt = '各位主管、同仁:'.APPEND i_contents_txt.i_contents_txt = ' '.APPEND i_contents_txt.IF matnr[] IS INITIAL.i_contents_txt = ' 附件为成品库存货龄表!'.ELSE.i_contents_txt = ' 附件为复配料库存货龄表!'.ENDIF.APPEND i_contents_txt.i_contents_txt = ' 此邮件为系统发送,不需要回复'.APPEND i_contents_txt.i_contents_txt = ' 如果您有任务疑问,请联系SAP管理员'.APPEND i_contents_txt.i_contents_txt = ' '.APPEND i_contents_txt.i_contents_txt = tmp_date.APPEND i_contents_txt.DESCRIBE TABLE i_contents_txt LINES tab_lines.READ TABLE i_contents_txt INDEX tab_lines.w_doc_data-doc_size = ( tab_lines - 1 ) * 255 + strlen( i_contents_txt ). ********count lines by man context*************CLEAR i_packing_list-transf_bin.i_packing_list-transf_bin = space. "ASCII format/binary formati_packing_list-head_start = 1.i_packing_list-head_num = 0.i_packing_list-body_start = 1.i_packing_list-body_num = tab_lines.i_packing_list-doc_type = 'RAW'.APPEND i_packing_list.ENDFORM. " DEFINE_MAIL_HEADERFORM define_mail_attachment .CONCATENATE lv_string'物料描述' gc_tab'物料组' gc_tab'⼯⼚' gc_tab'库存描述' gc_tab'批次' gc_tab'⾮限制库存数量' gc_tab'冻结库存数量' gc_tab'质检库存数量' gc_tab'单位' gc_tab'保质期(天)' gc_tab'货龄天数' gc_tab'距离失效天数' gc_crlfINTO lv_string.IF matnr[] IS NOT INITIAL.SELECT * FROM zmm028 INTO TABLE @DATA(lt_zmm028). SORT lt_zmm028 BY matnr.ENDIF.LOOP AT gt_data INTO gs_data ."增加前导零CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'EXPORTINGinput = gs_data-matnrIMPORTINGoutput = gs_data-matnr.IF matnr[] IS INITIAL.CASE gs_data-extwg.WHEN '101' OR '103' OR '104' OR '106' OR '107' OR '190'. CHECK gs_data-hlts > 7.WHEN '102'."3CHECK gs_data-hlts > 3.WHEN '105'."30CHECK gs_data-hlts > 30.WHEN OTHERS.CONTINUE.ENDCASE.ELSE.READ TABLE lt_zmm028 INTO DATA(ls_zmm028)WITH KEY matnr = gs_data-matnr .IF sy-subrc NE 0.CONTINUE.ELSE.CHECK gs_data-hlts >= ls_zmm028-zday.ENDIF.ENDIF."去除前导零CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT' EXPORTINGinput = gs_data-matnrIMPORTINGoutput = gs_data-matnr.lv_string = lv_string &&gs_data-maktx && gc_tab &&gs_data-ewbez && gc_tab &&gs_data-werks && gc_tab &&gs_data-lgobe && gc_tab &&gs_data-charg && gc_tab &&gs_data-clabs && gc_tab &&gs_data-cspem && gc_tab &&gs_data-cinsm && gc_tab &&gs_data-meins && gc_tab &&gs_data-mhdhb && gc_tab &&gs_data-hlts && gc_tab &&gs_data-sxts && gc_crlf.ENDLOOP.* Convert string to xstring type* 'APPLICATION/MSEXCEL;charset=utf-16le'CALL FUNCTION 'SCMS_STRING_TO_XSTRING'EXPORTINGtext = lv_stringmimetype = c_mimetypeIMPORTINGbuffer = v_xattachEXCEPTIONSfailed = 1OTHERS = 2.* Add the file header for utf-16le. .IF sy-subrc = 0.CONCATENATE cl_abap_char_utilities=>byte_order_mark_littlev_xattach INTO v_xattach IN BYTE MODE.ENDIF.CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'EXPORTINGbuffer = v_xattachTABLESbinary_tab = i_contents_hex.***set attachment name, count size*******************DESCRIBE TABLE gt_data LINES tab_lines.tab_lines = tab_lines .i_packing_list-transf_bin = 'X'.i_packing_list-head_start = 1.i_packing_list-head_num = 0.i_packing_list-body_start = 1.i_packing_list-body_num = tab_lines.i_packing_list-doc_type = 'XLS'.i_packing_list-obj_name = 'ATTACHMENT'.i_packing_list-obj_descr = 'Finished Stock'. "成品库存货龄表修改为英⽂i_packing_list-doc_size = tab_lines * 255.APPEND i_packing_list.ENDFORM. " DEFINE_MAIL_ATTACHMENTFORM get_receivers .* Add the recipients email addressCLEAR i_receivers.REFRESH i_receivers.* SELECT * FROM zszmail.LOOP AT i_sendmail.* I_RECEIVERS-RECEIVER = 'pandeng@'."Email Addressi_receivers-receiver = i_sendmail-receiver.i_receivers-rec_type = 'U'. "Internet addressi_receivers-notif_read = ''.i_receivers-com_type = 'INT'.i_receivers-notif_del = ''.i_receivers-notif_ndel = ''.APPEND i_receivers.ENDLOOP.* ENDSELECT.ENDFORM. " GET_RECEIVERSFORM send_email_message.DATA: w_subrc LIKE sy-subrc.* Call the FM to post the message to SAPMAILCALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'EXPORTINGdocument_data = w_doc_data "Attributes of new documentput_in_outbox = 'X' "Flag: Move document to outbox after sendcommit_work = 'X' "An explicit COMMIT WORK is to be setIMPORTINGsent_to_all = w_sent_allTABLESpacking_list = i_packing_list "Information about structure of data tables object_header = i_object_headercontents_hex = i_contents_hexcontents_txt = i_contents_txt "ASCII contents of object and attachments receivers = i_receivers "Document recipients with send attributes EXCEPTIONStoo_many_receivers = 1document_not_sent = 2document_type_not_exist = 3operation_no_authorization = 4parameter_error = 5x_error = 6enqueue_error = 7OTHERS = 8.w_subrc = sy-subrc.WAIT UP TO 2 SECONDS.IF w_subrc EQ 0.SUBMIT rsconn01 WITH mode = 'INT' WITH output = spaceAND RETURN.ENDIF.ENDFORM. " SEND_EMAIL_MESSAGE。
基于ASP.NET2.0的HTML格式的电子邮件发送
表 示 电子 邮件 的 附件 。 表 示 电子 邮件 附 件 的基 类 。 At h tc— a
m n 、 h raeiw和 Ln e R su - e tA en tve ik d eo r
c 从此 类 派 生 。 e类
5 Ate m nC l co 存储将作为 电子邮件的一部分发送 t h etol t n a ei 的附件。 6 Lne R su 2 ikd eo le x 表示 电子邮件附件中嵌入的外部 资 源, H ML附件中的图像 。 如 T
的链 接 资 源 。
Tu re即可 。 为了演 示如何发送一个 H ML格式的消息, T 创建
了一 个 示例 , 名 字 为 Hm E a . p 。代码 如下 : 其 tl m ia x ls
() 1 创建 Ma M sae实例 i esg l
D m I n As N w Ma Mesg ( mmE al d r s i n e i sa e F l l m A de , i s
2 发送 H ML格 式 的 电子 邮件 T
在 A PN T 20中发 H ML格式的 电子邮件,只要简 S .E . T 单地把 Ma M sae 的 B d 属 性设置为要发送 的 H M i esg 类 l oy TL
内 容 , 然 后 把 MaMesg i sae类 的 I oy m 属 性 设 置 为 l s dHtl B
d ̄ 8 Is )
7 Lne R su e o e— 存储将作为电子邮件的一部分发送 i d e r Cle k oc l
tn i o
TE i A - o ma d l
8 Ma A des i d rs l
表示电子邮件 发件人或收件人的地
用ASP发送邮件
可以通过Jmail组件发送邮件. 首先要在WEB服务器安装JMAIL组件. 下面是一个对象实例,可以通过call SendMail (receive)的方法来调用发送邮件-可以通过Jmail组件发送邮件.首先要在WEB服务器安装JMAIL组件.下面是一个对象实例,可以通过call SendMail (receive)的方法来调用发送邮件<%On Error Resume NextSet jmail = Server.CreateObject("JMAIL.Message")jmail.silent = false '屏蔽例外错误,返回FALSE跟TRUE两值jmail.logging = true '启用邮件日志jmail.Charset = "gb2312"jmail.AddRecipient "mgr9525@" '邮件收件人的地址jmail.From = "mgr95225@" '发件人的E-MAIL地址jmail.FromName = "主题" '发件人名jmail.MailServerUserName = "mgr95225@" '邮箱用户名jmail.MailServerPassword = "xxx" '邮箱密码jmail.Subject = "Message" '邮件主题JMail.ContentType="text/html"jmail.Body = "body" '邮件内容jmail.Priority = 3 '邮件的紧急程序,1 为最快,5 为最慢,3 为默认值mailserver="" '发件服务器jmail.Send(mailserver) '执行邮件发送(通过邮件服务器地址)If Err.Number<>0 thensendMsg="发送失败!"ElsesendMsg="已发送!"End IfResponse.Write(sendMsg)jmail.Close()set jmail=nothing%>jmail 组件可以网上下载有些时候邮件发不出去---程序没有错误的前提下第一次碰到的邮件发不出去是因为没有取到收信人邮箱。
ASP+Jmail提交表单到指定邮箱方法
下面以申请友情链接为例,介绍利用ASP+JMail的方法将表单数据发送到指定邮箱。
之所以选择JMail为例,是因为国内大部分主机都支持Jmail组件。
Html表单页面代码:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>友情链接申请</title></head><body><form id="form" name="form" method="post" action="send.asp" ><ul><h1>web技术收藏夹友情链接申请</h1><li><input type="text" name="pname" />网站名称</li><li><input type="text" name="pname" />网址</li><li><input type="text" name="pname" />您的邮箱</li><li><input type="text" name="pname" />链接关键词</li><li><textarea name="msgg" cols="60" rows="5" >网站介绍</textarea></li><Li><input name="submit" type="submit" value="提交" /></Li></ul></form></body></html>send.asp页面代码:<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta http-equiv=refresh content=3;url=''/><title>友情链接提交成功</title></head><!--定义3秒钟自动跳转--><script language="JavaScript">functioncountDown(secs){jump.innerText=secs;if(--secs>0)setTimeout( "countDown(" +secs+ ")" ,1000);}countDown(3);</script><body><%'下面是定义一些变量,是这些变量从表单页面获取信息webname=Request.Form ("webname")website=Request.Form ("website")key=Request.Form ("key")email=Request.Form ("email")message=Request.Form ("message")' 下面就是调用从表单页获取的信息,赋值到mess,&是连接符,vbcrlf表示换行回车: mess = mess & "---------------Webmail表单开始-------------------" &vbcrlfmess = mess & "网站名称:" &webname&vbcrlfmess = mess & "网址:" & website &vbcrlfmess = mess & "关键词:" & key &vbcrlfmess = mess & "Email:" & email &vbcrlfmess = mess & "网站介绍:" & message &vbcrlfmess = mess & "---------------Webmail表单结束-------------------" &vbcrlf' 下面是调用Jmail组件的部分,其中邮箱,密码填写正确的,否则发送不成功Set JMail=Server.CreateObject("JMail.Message")JMail.silent = true '则errorcode包含的是错误代码JMail.Logging=True '是否使用日志JMail.Charset="gb2312"JMail.ContentType = "text/plain" 'text/html是超文本格式text/plain是文本格式JMail.MailServerUserName = "xxx123@" '您的邮件服务器登录名JMail.MailServerPassword = "xxxxxxx" '登录密码JMail.From = "xxx123@" '发件人(要填合法正确邮箱才能发出去信件)JMail.FromName = "阿泰ATai" '发件人姓名JMail.AddRecipient "360cold@" '收件人JMail.Subject = "友情链接申请" '主题,JMail.Body = mess '正文,JMail.Send "" 'smtp服务器地址JMail.Priority=3 '1: 最高优先级.2:高3:普通4:低5:最低Set JMail=nothing%><CENTER>提交成功,我们会尽快审核回复,谢谢!</CENTER><p align="center">--- < <font color=blue>3</font>秒钟后自动跳转至主页<a href="">(点击跳转) </a>> ---</p></body></html>。
在asp中发送邮件 表单提交到邮箱 表单发送到邮箱
在asp中发送邮件表单提交到邮箱表单发送到邮箱1.Jmail的用法Jmail的使用说明<%Dim SendStatSendStat = Jmail("wyongzhi@","Test Jmail","Just a test!","US-ASCII","text/plain") Response.Write SendStat%><%'--------------------------------------------------------------------Function Jmail(mailTo,mailTopic,mailBody,mailCharset,mailContentType)'--------------------------------------------------------------------'JMail'--------------------------------------------------------------------'入口参数:'mailTo 收件人email地址'mailTopic 邮件主题'mailBody 邮件正文(内容)'mailCharset 邮件字符集,例如GB2312或US-ASCII'mailContentType 邮件正文格式,例如text/plain或text/html'返回值:'字符串,发送成功后返回OK,不成功返回错误信息'使用方法:'1)设置好常量,即以Const开头的变量'2)使用类似如下代码发信'Dim SendStat'SendStat = Jmail("aa@","测试Jmail","这是一封<br/>测试信!","GB2312","text/html") 'Response.Write SendStat'--------------------------------------------------------------------'***************根据需要设置常量开始*****************DimConstFromNameCn,ConstFromNameEn,ConstFrom,ConstMailDomain,ConstMailServerUserName,ConstMailServerPasswordConstFromNameCn = ""'发信人中文姓名(发中文邮件的时候使用),例如'张三' ConstFromNameEn = ""'发信人英文姓名(发英文邮件的时候使用),例如'zhangsan' ConstFrom = ""'发信人邮件地址,例如'zhangsan@'ConstMailDomain = ""'smtp服务器地址,例如 ConstMailServerUserName = ""'smtp服务器的信箱登陆名,例如'zhangsan'。
如何实现电子邮件的自动发送?
如何实现电子邮件的自动发送?请问如何在线发送电子邮件?我们可以利用MailMessage和SmtpMail对象来实现这一功能。
前者设定邮件的内容,后者负责发送:<%@import namespace="system.web.uit"%>dim mail as new mailmessage'建立一个mailmessage对象mail.to=收件人mail.form=送件人mail.subject=主题mail.bodyformat=格式mail.body=内容smtpmail.send(mail)具体代码如下:<%@ Import Namespace="System.Web.Util" %><html><head><title>精彩春风之电子邮件发送</title></head><body BgColor="White"><Form runat="server"><Table Border=1><Tr><Td>收件人:</Td><Td><Input Type="Text" id="mailTo" Size=40 runat="server"/></Td></Tr><Tr><Td>发件人:</Td><Td><Input Type="Text" id="mailFrom" Size=40 runat="server"/></Td></Tr><Tr><Td>主题:</Td><Td><Input Type="Text" id="mailSubject" Size=40 runat="server"/></Td></Tr><Tr><Td>内容:</Td><Td><TextArea id="mailBody" Rows=8 Cols=60 runat="server"></TextArea></Td></Tr></Table><Input Type="Button" Value="立即发送" id="Button1" OnServerClick="Button1_Click" runat="server"/></Form><asp:Label id="Label1" runat="server"/></Body></Html><script Language="VB" runat="server">Sub Button1_Click(sender As Object, e As EventArgs)Dim mail As MailMessage = New MailMessagemail.To= mailTo.Valuemail.From= mailFrom.Valuemail.Subject= mailSubject.Valuemail.BodyFormat=mail.format.textmail.Body= mailBody.Value' 读取表单的mailto等,分别指定给mail对象的to等属性SmtpMail.Send(mail)' 调用smtpmail发送Label1.Text = "恭喜,邮件发送成功!"End Sub</script>。
邮件发送网页实验报告
一、实验目的1. 掌握HTML语言的基本语法和结构;2. 了解CSS样式表的使用方法;3. 掌握JavaScript脚本语言的基本语法和函数编写;4. 学会使用邮件发送网页,实现网页与用户交互。
二、实验环境1. 操作系统:Windows 102. 浏览器:Google Chrome3. 开发工具:Visual Studio Code4. 服务器:Apache HTTP Server三、实验内容1. 创建HTML页面2. 添加CSS样式3. 编写JavaScript脚本4. 实现邮件发送功能四、实验步骤1. 创建HTML页面(1)新建一个名为“mail.html”的文件,并输入以下代码:```html<!DOCTYPE html><html><head><title>邮件发送网页</title><link rel="stylesheet" type="text/css" href="style.css"></head><body><h1>邮件发送网页</h1><form action="mail.php" method="post"><label for="name">姓名:</label><input type="text" id="name" name="name" required><br><br><label for="email">邮箱:</label><input type="email" id="email" name="email" required><br><br><label for="message">留言:</label><textarea id="message" name="message" required></textarea><br><br> <input type="submit" value="发送邮件"></form></body></html>```(2)保存文件,并在浏览器中打开,查看效果。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
<body>
<form method="post" action="">
发件人名称:<input type="text" name="fname"><br>
发件人邮箱:<input type="text" name="femail"><br>
收件人名称:<input type="text" name="tname"><br>
jmail.maildomain="邮件服务器域名" '邮件发送服务器域名
sendok=jmail.send("smtp服务器名") 'smtp服务器名称
if sendok then
response.write "恭喜您,邮件发送成功
else
response.write "对不起,邮件发送失败,可能由于服务器登录设置配置不当造成或填写的信息有误,请确认正确后再进行发送!"
收件人邮箱:<input type="text" name="temail"><br>
邮件标题:<input type="text" name="title"><br>
邮件内容:<textarea rows="9" cols="40" name="content"></textarea><br>
<div align="center"><input type="submit" name="submit" value="/blog/发送"></div>
</form>
</body>
</html>
已经全部结束了,上面那个发送邮件的asp代码中的注释部分可以用表单值代替,不过最好写成先把值赋给一个变量,如:title=request.form("title"),然后把注释部份用title代替,一但用了变变量赋值时就要把jmail.subject=""这对引号去掉了可以直接写成jmail.subject=title就OK了。
jmail.addrecipient "收件人邮箱地址","收件人姓名"
jmail.subject="发送邮件标题" '该值可以从数据库或表单中取值
jmail.mailserverusername="smtp服务器登录用户名" '邮件发送服务器登录名称
jmail.mailserverpassword="smtp服务器登录密码" '邮件发送服务器登录密码
<%
dim jmail
set jmail=server.createobject("Jmail.message")
jmail.silent=true
jmail.charset="gb2312"
jmail.fromname="发件人名称" '这里是发件人名称,可以从数据库或表单中取值
jmail.from="发件人邮箱" '这里是发件人邮箱,可以从数据库或表单中取值,但格式一定要正确
end if
%>
上面就是利用jmail发送邮件的主要代码
下面还有一个html页面就是用来填写发送信息的
<html>
<head>
<title>在线发送邮件</title>
<meta http-equiv="content-type=" content="text/html; charset=gb2312">