mailtest
chown命令的用法
chown命令的用法chown命令的用法chown将指定文件的拥有者改为指定的用户或组,用户可以是用户名或者用户id;组可以是组名或者组id;文件是以空格分开的要改变权限的文件列表,支持通配符。
系统管理员经常使用chown 命令,在将文件拷贝到另一个用户的名录下之后,让用户拥有使用该文件的权限。
1.命令格式:chown [选项]... [所有者][:[组]] 文件...2.命令功能:通过chown改变文件的拥有者和群组。
在更改文件的所有者或所属群组时,可以使用用户名称和用户识别码设置。
普通用户不能将自己的文件改变成其他的拥有者。
其操作权限一般为管理员。
3.命令参数:必要参数:-c 显示更改的部分的信息-f 忽略错误信息-h 修复符号链接-r 处理指定目录以及其子目录下的所有文件-v 显示详细的处理信息-deference 作用于符号链接的指向,而不是链接文件本身选择参数:--reference= 把指定的目录/文件作为参考,把操作的文件/目录设置成参考文件/目录相同拥有者和群组--from= 只有当前用户和群组跟指定的用户和群组相同时才进行改变--help 显示帮助信息--version 显示版本信息4.使用实例:实例1:改变拥有者和群组命令:chown mail:mail log2012.log输出:[root@localhost test6]# ll---xr--r-- 1 root users 302108 11-30 08:39 linklog.log ---xr--r-- 1 root users 302108 11-30 08:39 log2012.log -rw-r--r-- 1 root users 61 11-30 08:39 log2013.log-rw-r--r-- 1 root users 0 11-30 08:39 log2014.log-rw-r--r-- 1 root users 0 11-30 08:39 log2015.log-rw-r--r-- 1 root users 0 11-30 08:39 log2016.log-rw-r--r-- 1 root users 0 11-30 08:39 log2017.log[root@localhost test6]# chown mail:mail log2012.log [root@localhost test6]# ll---xr--r-- 1 root users 302108 11-30 08:39 linklog.log---xr--r-- 1 mail mail 302108 11-30 08:39 log2012.log -rw-r--r-- 1 root users 61 11-30 08:39 log2013.log-rw-r--r-- 1 root users 0 11-30 08:39 log2014.log-rw-r--r-- 1 root users 0 11-30 08:39 log2015.log-rw-r--r-- 1 root users 0 11-30 08:39 log2016.log-rw-r--r-- 1 root users 0 11-30 08:39 log2017.log [root@localhost test6]#说明:实例2:改变文件拥有者和群组命令:chown root: log2012.log输出:[root@localhost test6]# ll总计 604---xr--r-- 1 root users 302108 11-30 08:39 linklog.log ---xr--r-- 1 mail mail 302108 11-30 08:39 log2012.log -rw-r--r-- 1 root users 61 11-30 08:39 log2013.log-rw-r--r-- 1 root users 0 11-30 08:39 log2014.log-rw-r--r-- 1 root users 0 11-30 08:39 log2015.log-rw-r--r-- 1 root users 0 11-30 08:39 log2016.log-rw-r--r-- 1 root users 0 11-30 08:39 log2017.log [root@localhost test6]# chown root: log2012.log [root@localhost test6]# ll总计 604---xr--r-- 1 root users 302108 11-30 08:39 linklog.log ---xr--r-- 1 root root 302108 11-30 08:39 log2012.log -rw-r--r-- 1 root users 61 11-30 08:39 log2013.log-rw-r--r-- 1 root users 0 11-30 08:39 log2014.log-rw-r--r-- 1 root users 0 11-30 08:39 log2015.log-rw-r--r-- 1 root users 0 11-30 08:39 log2016.log-rw-r--r-- 1 root users 0 11-30 08:39 log2017.log [root@localhost test6]#说明:实例3:改变文件群组命令:chown :mail log2012.log输出:[root@localhost test6]# ll总计 604---xr--r-- 1 root users 302108 11-30 08:39 linklog.log ---xr--r-- 1 root root 302108 11-30 08:39 log2012.log -rw-r--r-- 1 root users 61 11-30 08:39 log2013.log-rw-r--r-- 1 root users 0 11-30 08:39 log2014.log-rw-r--r-- 1 root users 0 11-30 08:39 log2015.log-rw-r--r-- 1 root users 0 11-30 08:39 log2016.log-rw-r--r-- 1 root users 0 11-30 08:39 log2017.log [root@localhost test6]# chown :mail log2012.log [root@localhost test6]# ll总计 604---xr--r-- 1 root users 302108 11-30 08:39 linklog.log ---xr--r-- 1 root mail 302108 11-30 08:39 log2012.log -rw-r--r-- 1 root users 61 11-30 08:39 log2013.log-rw-r--r-- 1 root users 0 11-30 08:39 log2014.log-rw-r--r-- 1 root users 0 11-30 08:39 log2015.log-rw-r--r-- 1 root users 0 11-30 08:39 log2016.log-rw-r--r-- 1 root users 0 11-30 08:39 log2017.log说明:实例4:改变指定目录以及其子目录下的所有文件的拥有者和群组命令:chown -r -v root:mail test6输出:[root@localhost test]# lldrwxr-xr-x 2 root users 4096 11-30 08:39 test6[root@localhost test]# chown -r -v root:mail test6“test6/log2014.log”的所有者已更改为 root:mail“test6/linklog.log”的所有者已更改为 root:mail“test6/log2015.log”的所有者已更改为 root:mail“test6/log2013.log”的所有者已更改为 root:mail“test6/log2012.log”的所有者已保留为 root:mail“test6/log2017.log”的所有者已更改为 root:mail“test6/log2016.log”的所有者已更改为 root:mail“test6”的所有者已更改为 root:mail[root@localhost test]# lldrwxr-xr-x 2 root mail 4096 11-30 08:39 test6[root@localhost test]# cd test6[root@localhost test6]# ll总计 604---xr--r-- 1 root mail 302108 11-30 08:39 linklog.log ---xr--r-- 1 root mail 302108 11-30 08:39 log2012.log -rw-r--r-- 1 root mail 61 11-30 08:39 log2013.log-rw-r--r-- 1 root mail 0 11-30 08:39 log2014.log-rw-r--r-- 1 root mail 0 11-30 08:39 log2015.log-rw-r--r-- 1 root mail 0 11-30 08:39 log2016.log-rw-r--r-- 1 root mail 0 11-30 08:39 log2017.log。
英文版检验报告
Tested by (name+signature) ............ : ...................................................... Witnessed by (name+signature) ...... : ...................................................... Supervised by (name+signature)...... : ...................................................... Approved by (name+signature) ........: ...................................................... Date of issue..................................... :.......... :Address ............................................ :Testing location/ procedure ..............: CBTL RMT SMT WMT TMPTesting location/ address.................. :............................ :Address ............................................ :Standard ........................................... : IEC 60598-2-1:1979+A1:1987 used in conjunction withIEC 60598-1:2003EN 60598-2-1:1979+A1:1987 used in conjunction withEN 60598-1:2004Test procedure ................................. : CB / CCANon-standard test method………….. :N/ATRF Originator .................................. : Intertek Semko ABMaster TRF....................................... : Dated 2004-09This publication may be reproduced in whole or in part for non-commercial purposes as long as the IECEE is acknowledged as copyright owner and source of the material. IECEE takes no responsibility for and will not assume liability for damages resulting from the reader's interpretation of the reproduced material due to its placement and context.Trade Mark ....................................... :Manufacturer .................................... :Model/Type reference....................... :Address ........................................... :Ratings ............................................. :................................................ .- test case does not apply to the test objec.t.................: N/A- test object does meet the requirement .....................:.. P(Pass)- test object does not meet the requiremen ................: F(Fail)....................................................................... ..Date of receipt of test item ......................................... ..Date (s) of performance of tests .................................:..The test results presented in this report relate only to the object tested.This report shall not be reproduced, except in full, without the written approval of the Issuing testing laboratory. "(see Enclosure #)" refers to additional information appended to the report."(see appended table)" refers to a table appended to the report.List of test equipment must be kept on file and available for review.Throughout this report a comma (point) is used as the decimal separator.In this report requirements valid for EN only are marked with (EN).1.2 (0.1)1.2 (0.3)1.4 (2.2) 1.4 (2.3) 1.4 (2.4)Yes / No Yes / No Luminaire for rough service .......................:1.5 (3.2) Mandatory markingsPosition of the marking Format of symbols/text1.5 (3.3) Additional informationLanguage of instructions 1.5 (3.3.1) Combination luminaires 1.5 (3.3.2) Nominal frequency in Hz 1.5 (3.3.3) Operating temperature 1.5 (3.3.4) Symbol or warning notice 1.5 (3.3.5) Wiring diagram 1.5 (3.3.6) Special conditions1.5 (3.3.7) Metal halide lamp luminaire – warning 1.5 (3.3.8) Limitation for semi-luminaires 1.5 (3.3.9) Power factor and supply current 1.5 Suitability for use indoors (3.3.10)1.5 Luminaires with remote control (3.3.11)1.5 Clip-mounted luminaire – warning (3.3.12)1.5 Specifications of protective shields (3.3.13)1.5 Symbol for nature of supply (3.3.14)1.5 Rated current of socket outlet (3.3.15)1.5 Rough service luminaire (3.3.16)Type of protection .......................................: Degree of protection ...................................: Luminaire only suitable for non-combustible surfaces .....................................................:Luminaire suitable for normally flammable surfaces ....................................................................: Luminaire suitable to be covered by insulating material .......................................................:Luminaire for normal use ........................... : More sections applicable .................................... :Information for luminaire design considered Standard Yes / No Yes / NoClass IP Yes / NoYes / No Yes / No1.4 (2.5)—————————最新精品文档,知识共享!1.5 Mounting instruction for type Y, type Z and some (3.3.17) type X attachments1.5 Non-ordinary luminaires with PVC cable(3.3.18)1.5 Adequate warning on the package (EN)(3.3.101)1.5 (3.4) Test with waterTest with hexaneLegible after testLabel attached1.6 (4.2) Components replaceable without difficulty1.6 (4.3) Wire ways smooth and free from sharp edges 1.6 (4.4) Lampholders1.6 (4.4.1) Integral lampholder1.6 (4.4.2) Wiring connection1.6 (4.4.3) Lampholder for end-to-end mounting1.6 (4.4.4) Positioning- pressure test (N) .................................. :- bending test (Nm) ................................. :1.6 (4.4.5) Peak pulse voltage1.6 (4.4.6) Centre contact1.6 (4.4.7) Parts in rough service luminaires resistance totracking1.6 (4.4.8) Lamp connectors1.6 (4.4.9) Caps and bases correctly used1.6 (4.5) Starter holdersStarter holder in luminaires other than class IIStarter holder class II construction1.6 (4.6) Terminal blocksTailsUnsecured blocks1.6 (4.7) Terminals and supply connections1.6 (4.7.1) Contact to metal parts1.6 (4.7.2) Test 8 mm live conductorTest 8 mm earth conductor1.6 (4.7.3) Terminals for supply conductors1.6 Welded connections:(4.7.3.1)- stranded or solid conductor- spot welding- welding between wires- Type Z attachment- mechanical test according to 15.8.2- electrical test according to 15.9- ageing test according to 15.9.2.3 and 15.9.2.4 1.6 (4.7.4) Terminals other than supply connection1.6 (4.7.5) Heat-resistant wiring/sleeves1.6 (4.7.6) Multi-pole plug- test at 30 N1.6 (4.8) Switches:- adequate rating- adequate fixing- polarized supply- compliance with 61058-1 for electronic switches 1.6 (4.9) Insulating lining and sleeves1.6 (4.9.1) RetainmentMethod of fixing........................................... :1.6 (4.9.2) Insulated linings and sleevesa) & c) Insulation resistance and electric strengthb) Ageing test. Temperature (°C) ............... :1.6 (4.10) Insulation of Class II luminaires1.6 No contact, mounting surface - accessible metal (4.10.1) parts - wiring of basic insulationSafe installation fixed luminairesCapacitors and switchesInterference suppression capacitors according toIEC 60384-141.6 Assembly gaps:(4.10.2)- not coincidental- no straight access with test probe1.6 Retainment of insulation:(4.10.3)- fixed- unable to be replaced; luminaire inoperative- sleeves retained in position- lining in lampholder1.6 (4.11) Electrical connections1.6 Contact pressure(4.11.1)1.6 Screws:(4.11.2)- self-tapping screws- thread-cutting screws- at least two self-tapping screws1.6 Screw locking:(4.11.3)- spring washer- rivets1.6 Material of current-carrying parts(4.11.4)1.6 No contact to wood(4.11.5)1.6 Electro-mechanical contact systems(4.11.6)1.6 (4.12) Mechanical connections and glands1.6 Screws not made of soft metal(4.12.1)Screws of insulating materialTorque test: torque (Nm); part ....................:Torque test: torque (Nm); part ....................:Torque test: torque (Nm); part ....................:1.6 Screws with diameter < 3 mm screwed into metal (4.12.2)1.6 Locked connections:(4.12.4)- fixed arms; torque (Nm) ............................ :- lampholder; torque (Nm) ........................... :- push-button switches; torque 0,8 Nm ....... :1.6 Screwed glands; force (N) ..........................:(4.12.5)1.6 (4.13) Mechanical strength1.6 Impact tests:(4.13.1)- fragile parts; energy (Nm) ......................... :- other parts; energy (Nm)........................... :1) live parts2) linings3) protection4) covers1.6 Straight test finger(4.13.3)1.6 Rough service luminaires(4.13.4)- IP54 or highera) fixedb) hand-heldc) delivered with a standd) for temporary installations and suitable formounting on a stand1.6 Tumbling barrel(4.13.6)1.6 (4.14) Suspensions and adjusting devices1.6 Mechanical load:(4.14.1)A) four times the weightB) torque 2,5 NmC) bracket arm; bending moment (Nm) ...... :D) load track-mounted luminairesE) clip-mounted luminaires, glass-shelve.Thickness (mm) ......................................... :metal rod. Diameter (mm) .......................... :Fixed luminaire or independent control gear withoutfixing devices1.6(4.14.2)1.6(4.14.3)1.6(4.14.4) 1.6(4.14.5) 1.6(4.14.6) 1.6 (4.15)1.6(4.15.2) 1.6 (4.16)1.6(4.16.1)1.6(4.16.2)1.6(4.16.3) 1.6 (4.17) Load to flexible cablesMass (kg) ....................................................:Stress in conductors (N/mm²) ..................... :Semi-luminaires – mass (kg) ..................... :Semi-luminaires – bending moment (Nm) .. :Adjusting devices:- flexing test; number of cycles ...................:- strands broken- electric strength test afterwardsTelescopic tubes: cords not fixed to tube; no strainon conductorsGuide pulleysStrain on socket-outletsFlammable materials:- glow-wire test 650 o C- spacing > 30 mm- screen withstanding test of 13.3.1- screen dimensions- no fiercely burning material- thermal protection- electronic circuits exemptedLuminaires made of thermoplastic material with lamp control geara) constructionb) temperature sensing controlc) surface temperatureLuminaires marked with F-symbolNo lamp control gearLamp control gear spacing:- spacing 35 mm- spacing 10 mmThermal protection:- in lamp control gear- external- fixed position- temperature marked lamp control gear"F" curve measuredDrain holesClearance at least 5 mm(compliance with Section 12)(see 12.6)最新精品文档,知识共享!1.6 (4.18) Resistance to corrosion:1.6 - rust-resistance(4.18.1)1.6 - season cracking in copper(4.18.2)1.6 - corrosion of aluminium(4.18.3)1.6 (4.19) Ignitors compatible with ballast1.6 (4.20) Rough service vibration1.6 (4.21) Protective shield:1.6 Shield fitted(4.21.1)1.6 Particles from a shattering lamp not impair safety (4.21.2)1.6 No direct path(4.21.3)1.6 Impact test on shield(4.21.4)Glow-wire test on lamp compartment1.6 (4.22) Attachments to lamps1.6 (4.23) Semi-luminaires comply class II1.6 (4.24) UV radiation, metal halide lamps1.6 (4.25) No sharp point or edges1.6 (4.26) Short-circuit protection:1.6 Uninsulated accessible SELV parts(4.26.1)1.6 Short-circuit test(4.26.2)1.6 Test chain according to Figure 29(4.26.3)最新精品文档,知识共享!Working voltage (V) ....................................:Voltage formPTIRated pulse voltage (kV) ............................ :1) Current-carrying parts of different polarity: cr (mm); cl (mm) ............................................. :2) Current-carrying parts and accessible parts: cr (mm); cl (mm) ............................................. :3) Parts becoming live due to breakdown ofbasic insulation and metal parts:cr (mm); cl (mm) ......................................... :4) Outer surface of cable where it is clamped and metal parts: cr (mm); cl (mm) ..................... :5) Not used6) Current-carrying parts and supporting surface: cr (mm); cl (mm) ............................................. :Sinusoidal [ ]Non-sinusoidal [ ]< 600 [ ] > 600 [ ]—————(see Annex 1) (see Annex 3)(see Annex 1) (see Annex 4)最新精品文档,知识共享!1.8 (7.2.1 + 7.2.3)Accessible metal partsMetal parts in contact with supporting surfaceResistance < 0,5Two self-tapping screws used Thread-forming screwsThread-forming screw used in a groove Connector earthing first1.8 (7.2.2 + 7.2.3)Earth continuity in joints etc.1.8 (7.2.4) Locking of clamping meansCompliance with 4.7.31.8 (7.2.5) Earth terminal integral part of connector socket 1.8 (7.2.6) Earth terminal adjacent to mains terminals 1.8 (7.2.7) Electrolytic corrosion of the earth terminal 1.8 (7.2.8) Material of earth terminalContact surface bare metal 1.8Class II luminaire for looping-in(7.2.10)Double or reinforced insulation to functional earth 1.8Earthing core coloured green-yellow(7.2.11)Length of earth conductorSeparately approved; component listPart of the luminaireSeparately approved; component listPart of the luminaire1.10 (5.2) Supply connection and external wiring1.10 Means of connection ................................... :(5.2.1)Connecting leads (EN)- without a means for connection to the supply- terminal block specified- relevant information provided- compliance with 4.6, 4.7.1, 4.7.2, 4.10.1, 11.2, 12and 13.2 of Part 11.10 Type of cable ..............................................:(5.2.2)Nominal cross-sectional area (mm²) ........... :1.10 Type of attachment, X, Y or Z(5.2.3)1.10 Type Z not connected to screws(5.2.5)1.10 Cable entries:(5.2.6)- suitable for introduction- adequate degree of protection1.10 Cable entries through rigid material have rounded (5.2.7) edges1.10 Insulating bushings:(5.2.8)- suitably fixed- material in bushings- material likely to deteriorate- tubes or guards made of insulating material1.10 Locking of screwed bushings(5.2.9)1.10 Cord anchorage:(5.2.10)- covering protected from abrasion- clear how to be effective- no mechanical or thermal stress- no tying of cables into knots etc.- insulating material or lining1.10 Cord anchorage for type X attachment:(5.2.10.1)a) at least one part fixedb) types of cablec) no damaging of the cabled) whole cable can be mountede) no touching of clamping screwsf) metal screw not directly on cableg) replacement without special toolGlands not used as anchorageLabyrinth type anchorages1.10 Adequate cord anchorage for type Y and type Z(5.2.10.2)attachment1.10 Tests:(5.2.10.3)- impossible to push cable; unsafe- pull test: 25 times; pull (N) ........................:- torque test: torque (Nm) ........................... :- displacement 2 mm- no movement of conductors- no damage of cable or cord1.10 External wiring passing into luminaire(5.2.11)1.10 Looping-in terminals(5.2.12)1.10 Wire ends not tinned(5.2.13)Wire ends tinned: no cold flow1.10 Mains plug same protection(5.2.14)Class III luminaire plug1.10 Appliance inlets (IEC 60320)(5.2.16)Appliance couplers of class II type1.10 No standardized interconnecting cables properly(5.2.17) assembled1.10 Used plug in accordance with(5.2.18) - IEC 60083- other standard1.10 (5.3) Internal wiring1.10 Internal wiring of suitable size and type(5.3.1)Through wiring- not delivered/ mounting instruction- factory assembled- socket outlet loaded (A) ............................ :(see Annex 2) - temperatures ............................................ :Green-yellow for earth only1.10 Internal wiring connected directly to fixed wiring(5.3.1.1)Cross-sectional area (mm²) ........................ :Insulation thicknessExtra insulation added where necessary1.10 Internal wiring connected to fixed wiring via internal current-limiting device (5.3.1.2)Adequate cross-sectional area and insulationthickness1.10 Double or reinforced insulation for class II(5.3.1.3)1.10 Conductors without insulation(5.3.1.4)1.10 SELV current-carrying parts(5.3.1.5)1.10 Insulation thickness other than PVC or rubber(5.3.1.6)1.10 Sharp edges etc.(5.3.2)No moving parts of switches etc.Joints, raising/lowering devicesTelescopic tubes etc.No twisting over 3601.10 Insulating bushings:(5.3.3)- suitable fixed- material in bushings- material likely to deteriorate- cables with protective sheath1.10 Joints and junctions effectively insulated(5.3.4)1.10 Strain on internal wiring(5.3.5)1.10 Wire carriers(5.3.6)1.10 Wire ends not tinned(5.3.7)Wire ends tinned: no cold flow最新精品文档,知识共享!1.11 Live parts not accessible(8.2.1)Basic insulated parts not used on the outer surfacewithout appropriate protectionProtection in any positionDouble-ended tungsten filament lampInsulation lacquer not reliableDouble-ended high pressure discharge lampRelevant warning according to 3.2.18 fitted to theluminaire1.11 Portable luminaire adjusted in most unfavourable (8.2.2) position1.11 Class II luminaire:(8.2.3)- basic insulated metal parts not accessible duringstarter or lamp replacement- basic insulation not accessible other than duringstarter or lamp replacement- glass protective shields not used assupplementary insulationClass I luminaire with BC lampholder1.11 Portable luminaire:(8.2.4)- protection independent of supporting surface- terminal block completely covered1.11 Compliance with the standard test finger or relevant (8.2.5) probe1.11 Covers reliably secured(8.2.6)1.11 Discharging of capacitors 0,5 F(8.2.7)Portable plug connected luminaire with capacitorOther plug connected luminaire with capacitorDischarge device on or within capacitorDischarge device mounted separately最新精品文档,知识共享!1.12 (12.3) Endurance test:- mounting-position .....................................:- test temperature (o C) ................................ :- total duration (h)........................................ :- supply voltage: Un factor; calculated voltage (V)....................................................................:- lamp used .................................................:1.12 After endurance test:(12.3.2)- no part unserviceable- luminaire not unsafe- no damage to track system- marking legible- no cracks, deformation etc.1.12 (12.4) Thermal test (normal operation) (see Annex 2) 1.12 (12.5) Thermal test (abnormal operation) (see Annex 2) 1.12 (12.6) Thermal test (failed lamp control gear condition):1.12 Through wiring or looping-in wiring loaded by a(12.6.1) current of (A) ................................ :- case of abnormal conditions ..................... :- electronic lamp control gear- measured winding temperature (o C) at 1,1 Un :- measured mounting surface temperature ( o C) at1,1 Un .........................................................:- calculated mounting surface temperature (o C) :- track-mounted luminaires1.12 Temperature sensing control(12.6.2)- case of abnormal conditions ..................... :- thermal link- manual reset cut-out- auto reset cut-out- measured mounting surface temperature ( o C)....................................................................:- track-mounted luminaires1.12 (12.7) Thermal test (failed lamp control gear in plastic luminaires):1.12 Through wiring or lopping-in wiring loaded by a(12.7.1) current of (A) .................................. :- case of abnormal conditions ..................... :- measured winding temperature (o C) at 1,1 Un :- measured temperature of fixing point/ exposedpart (o C) at 1,1 Un ....................................... :- calculated temperature of fixing point/ exposedpart (o C) ......................................................: ————————————最新精品文档,知识共享!Temperature sensing control1.12(12.7.2)- thermal link- manual reset cut-out- auto reset cut-out- measured temperature of fixing point/ exposedpart ( C) .....................................................:最新精品文档,知识共享!1.13 (9.2) Tests for ingress of dust, solid objects and moisture:- classification according to IP ....................: IP- mounting position during test .................... :- fixing screws tightened; torque (Nm) ........ :- tests according to clauses ........................:- electric strength test afterwardsa) no deposit in dust-proof luminaireb) no talcum in dust-tight luminairec) no trace of water on current-carrying parts orwhere it could become a hazardd) i) For luminaires without drain holes – no waterentryd) ii) For luminaires with drain holes – nohazardous water entrye) no water in watertight luminairef) no contact with live parts (IP 2X)f) no entry into enclosure (IP 3X and IP 4X)f) no contact with live parts (IP3X and IP4X)1.13 (9.3) Humidity test 48 h ————最新精品文档,知识共享!1.14 Insulation resistance test(10.2.1)Cable or cord covered by metal foil or replaced by ametal rodInsulation resistance (M ):SELV:- between current-carrying parts of different polarity....................................................................:- between current-carrying parts and mountingsurface ........................................................:- between current-carrying parts and metal parts ofthe luminaire ...............................................:Other than SELV:- between live parts of different polarity ......:- between live parts and mounting surface . :- between live parts and metal parts ........... :- between live parts of different polarity throughaction of a switch ........................................:1.14 Electric strength test(10.2.2)Dummy lampLuminaires with ignitors after 24 h testLuminaires with manual ignitorsTest voltage (V):SELV:- between current-carrying parts of different polarity....................................................................:- between current-carrying parts and mountingsurface ........................................................:- between current-carrying parts and metal parts ofthe luminaire ...............................................:Other than SELV:- between live parts of different polarity ......:- between live parts and mounting surface . :- between live parts and metal parts ........... :- between live parts of different polarity throughaction of a switch ........................................:1.14 Leakage current (mA) ................................. :(10.3.1)最新精品文档,知识共享!1.15 Ball-pressure test:(13.2.1)- part tested; temperature (o C) .................... :- part tested; temperature (o C) .................... : 1.15 Needle flame test (10 s):(13.3.1)- part tested ................................................. :- part tested ................................................. : 1.15 Glow wire test (650 o C):(13.3.2)- part tested ................................................. :- part tested ................................................. : 1.15 Tracking test: part tested ............................: (13.4.1)(2.2)(3.3)(4.5.1)(4.5.1)(5.2.1)(13.3) (13.3) (13.3.2) Class 0 not acceptedDK: power supply cord with labelIT: warning label on Class 0 luminaireDK: socket-outletsFR: socket-outletsDK, FI, SE, GB: type of plugDK: Needle flame test during 30 s for luminaires in access routesGB: Requirements according to United Kingdom Building RegulationFR: Glow-wire test 850o C alt. 750o C for luminaires in premises open to publictype/model technical data standardThe codes above have the following meaning:A - The component is replaceable with another one, also certified, with equivalent characteristicsB - The component is replaceable if authorised by the test houseC - Integrated component tested together with the applianceD - Alternative componentcode manufacturer/trademarkmark(s) ofconformityobject/part No.Type reference ............................................ :Lamp used ..................................................:Lamp control gear used .............................. :Mounting position of luminaire ....................:Supply wattage (W)..................................... :Supply current (A) ....................................... :Calculated power factor ..............................:Table: measured temperatures corrected for ta = 25 。
夜莺v5报警python脚本
夜莺v5报警python脚本夜莺v5 报警python脚本#!/usr/bin/python# -*- coding: UTF-8 -*-## n9e-server把告警事件通过stdin的⽅式传⼊notify.py,notify.py从事件中解析出接收⼈信息、拼出通知内容,发送通知# 脚本的灵活性⾼,要接⼊短信、电话、jira、飞书等,都⾮常容易,只要有接⼝,notify.py去调⽤即可#import sysimport jsonimport osimport smtplibimport timeimport requestsfrom email.mime.text import MIMETextfrom email.header import Headerfrom bottle import templatereload(sys) # reload 才能调⽤ setdefaultencoding ⽅法sys.setdefaultencoding('utf-8') # 设置'utf-8'################################## 邮件告警,修改下⾯的配置 ##################################mail_host = ""mail_port = 465mail_user = "fengjian21@"mail_pass = "Ccjsj1200))"mail_from = "fengjian21@"# 本地告警event json存储⽬录LOCAL_EVENT_FILE_DIR = "/data/monitor/n9eserver/etc/script/.alerts"NOTIFY_CHANNELS_SPLIT_STR = ""NOTIFY_CHANNEL_DICT = {"email":"email","sms":"sms","voice":"voice","dingtalk":"dingtalk","wecom":"wecom"}# stdin 告警json实例TEST_ALERT_JSON = {"event": {"alert_duration": 10,"notify_channels": "dingtalk","res_classpaths": "all","id": 4,"notify_group_objs": None,"rule_note": "","history_points": [{"metric": "go_goroutines","points": [{"t": 1625213114,"v": 33.0}],"tags": {"instance": "localhost:9090","job": "prometheus"}}],"priority": 1,"last_sent": True,"tag_map": {"instance": "localhost:9090","job": "prometheus"},"hash_id": "ecb258d2ca03454ee390a352913c461b","status": 0,"tags": "instance=localhost:9090 job=prometheus","trigger_time": 1625213114,"res_ident": "ident1","rule_name": "alert_test","is_prome_pull": 1,"notify_users": "1","notify_groups": "","runbook_url": "","values": "[vector={__name__=\"go_goroutines\", instance=\"localhost:9090\", job=\"prometheus\"}]: [value=33.000000]", "readable_expression": "go_goroutines>0","notify_user_objs": None,"is_recovery": 1,"rule_id": 1},"rule": {"alert_duration": 10,"notify_channels": "dingtalk","enable_stime": "00:00","id": 1,"note": "","create_by": "root","append_tags": "","priority": 1,"update_by": "root","type": 1,"status": 0,"recovery_notify": 0,"enable_days_of_week": "1 2 3 4 5 6 7","callbacks": "localhost:10000","notify_users": "1","notify_groups": "","runbook_url": "","name": "a","update_at": 1625211576,"create_at": 1625211576,"enable_etime": "23:59","group_id": 1,"expression": {"evaluation_interval": 4,"promql": "go_goroutines>0"}},"users": [{"username": "root","status": 0,"contacts": {"dingtalk_robot_token": "xxxxxx"},"create_by": "system","update_at": 1625211432,"create_at": 1624871926,"email": "","phone": "","role": "Admin","update_by": "root","portrait": "","nickname": "\u8d85\u7ba1","id": 1}]}def main():payload = json.load(sys.stdin)trigger_time = payload['event']['trigger_time']event_id = payload['event']['id']rule_id = payload['rule']['id']notify_channels = payload['event'].get('notify_channels').strip().split(NOTIFY_CHANNELS_SPLIT_STR)if len(notify_channels) == 0:msg = "notify_channels_empty"print(msg)return# 持久化到本地json⽂件persist(payload, rule_id, event_id, trigger_time)# ⽣成告警内容alert_content = sms_content_gen(values_gen(payload))for ch in notify_channels:send_func_name = "send_{}".format(NOTIFY_CHANNEL_DICT.get(ch.strip()))has_func = hasattr(Send, send_func_name)if not has_func:msg = "[send_func_name_err][func_not_found_in_Send_class:{}]".format(send_func_name)print(msg)continuesend_func = getattr(Send, send_func_name)send_func(alert_content, payload)def values_gen(payload):event_obj = payload.get("event")res_tags = event_obj.get("tags").encode('unicode-escape').decode('string_escape').split('')#res_tags = event_obj.get("tags").encode('unicode-escape').decode('string_escape').split('')[6:9]res_value = event_obj.get("values").encode('unicode-escape').decode('string_escape').split(':')[-1]#print res_tagsvalues = {"IsAlert": event_obj.get("is_recovery") == 0,"IsMachineDep": event_obj.get("res_classpaths") != "","Status": status_gen(event_obj.get("priority"),event_obj.get("is_recovery")),"Sname": event_obj.get("rule_name"),"Ident": event_obj.get("res_ident"),"Classpath": event_obj.get("res_classpaths"),"Metric": metric_gen(event_obj.get("history_points")),"Tags": res_tags,"Value": res_value,"ReadableExpression": event_obj.get("readable_expression"),"TriggerTime": time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(event_obj.get("trigger_time"))),"Elink": "/strategy/edit/{}".format(event_obj.get("rule_id")),"Slink": "/event/{}".format(event_obj.get("id"))}return valuesdef email_content_gen(values):return template('/data/monitor/n9eserver/etc/script/tpl/mail.tpl', values)def sms_content_gen(values):return template('/data/monitor/n9eserver/etc/script/tpl/sms.tpl', values)def status_gen(priority,is_recovery):is_recovery_str_m = {1: "恢复", 0: "告警"}status = "P{} {}".format(priority, is_recovery_str_m.get(is_recovery))return statusdef subject_gen(priority,is_recovery,rule_name):is_recovery_str_m = {1: "恢复", 0: "告警"}subject = "P{} {} {}".format(priority, is_recovery_str_m.get(is_recovery), rule_name)return subjectdef metric_gen(history_points):metrics = []for item in history_points:metrics.append(item.get("metric"))return",".join(metrics)def persist(payload, rule_id, event_id, trigger_time):if not os.path.exists(LOCAL_EVENT_FILE_DIR):os.makedirs(LOCAL_EVENT_FILE_DIR)filename = '%d_%d_%d' % (rule_id, event_id, trigger_time)filepath = os.path.join(LOCAL_EVENT_FILE_DIR, filename)with open(filepath, 'w') as f:f.write(json.dumps(payload, indent=4))class Send(object):@classmethoddef send_email(cls, alert_content, payload):users = payload.get("users")emails = [x.get("email") for x in users]if not emails:returnrecipients = emailsmail_body = email_content_gen(values_gen(payload))message = MIMEText(mail_body, 'html', 'utf-8')message['From'] = mail_frommessage['To'] = ", ".join(recipients)message["Subject"] = subject_gen(payload.get("event").get("priority"),payload.get("event").get("is_recovery"),payload.get("event").get("rule_name")) smtp = smtplib.SMTP_SSL(mail_host, mail_port)smtp.login(mail_user, mail_pass)smtp.sendmail(mail_from, recipients, message.as_string())smtp.close()print("send_mail_success")@classmethoddef send_wecom(cls, alert_content, payload):users = payload.get("users")for u in users:contacts = u.get("contacts")wecom_robot_token = contacts.get("wecom_robot_token", "")if wecom_robot_token == "":continuewecom_api_url = "https:///cgi-bin/webhook/send?key={}".format(wecom_robot_token)atMobiles = [u.get("phone")]headers = {'Content-Type': 'application/json;charset=utf-8'}payload = {"msgtype": "text","text": {"content": alert_content},"at": {"atMobiles": atMobiles,"isAtAll": False}}res = requests.post(wecom_api_url, json.dumps(payload), headers=headers)print(res.status_code)print(res.text)print("send_wecom")@classmethoddef send_dingtalk(cls, alert_content, payload):# 钉钉发群信息需要群的webhook机器⼈ token,这个信息可以在user的contacts map中users = payload.get("users")for u in users:contacts = u.get("contacts")dingtalk_robot_token = contacts.get("dingtalk_robot_token", "")if dingtalk_robot_token == "":print("dingtalk_robot_token_not_found")continuedingtalk_api_url = "https:///robot/send?access_token={}".format(dingtalk_robot_token)atMobiles = [u.get("phone")]headers = {'Content-Type': 'application/json;charset=utf-8'}payload = {"msgtype": "text","text": {"content": alert_content},"at": {"atMobiles": atMobiles,"isAtAll": False}}res = requests.post(dingtalk_api_url, json.dumps(payload), headers=headers)print(res.status_code)print(res.text)print("send_dingtalk")def mail_test():print("mail_test_todo")recipients = ["627459560@", "fengjian21@"]payload = json.loads(json.dumps(TEST_ALERT_JSON))mail_body = email_content_gen(values_gen(payload))message = MIMEText(mail_body, 'html', 'utf-8')message['From'] = mail_frommessage['To'] = ", ".join(recipients)message["Subject"] = subject_gen(payload.get("event").get("priority"),payload.get("event").get("is_recovery"),payload.get("event").get("rule_name")) smtp = smtplib.SMTP_SSL(mail_host, mail_port)smtp.login(mail_user, mail_pass)smtp.sendmail(mail_from, recipients, message.as_string())smtp.close()print("mail_test_done")if __name__ == "__main__":if len(sys.argv) == 1:main()elif sys.argv[1] == "mail": mail_test()else:print("I am confused")。
linux mail 命令参数
linux mail 命令参数使用mail发邮件时,必须先将sendmail服务启动。
mail –s “邮件主题”–c”抄送地址”–b “密送地址” -- -f 发送人邮件地址–F 发件人姓名 < 要发送的邮件内容三种常用格式发信mail -s test yangfang@ #第一种方法,你可以把当前shell当成编辑器来用,编辑完内容后Ctrl-D结束echo “mail content”|mail -s test yangfang@ #第二种方法,我用的最多,可能是喜欢管道的缘故吧mail -s test yangfang@ < file #第三种方法,以file的内容为邮件内容发信指定特定的发送人:$ mail -s "just a test" 收信人邮箱地址 < 要发送的邮件内容文件 -- -f 发送人邮件地址 -F 发件人姓名。
效果是: 信件内容将发送给收信人邮箱,显示的发送人为发送人姓名<发送人邮件地址>,显示的内容为发送的邮件内容...包含命令执行结果的MAIL发送:echo -e `ls /tmp`|mail -s "test" fff@ < /tmp/dd.txt -- -f cc@ -F cci 忽略 tty 的中断讯号。
(interrupt)I 强迫设成互动模式。
(Interactive)v 列印出讯息,例如送信的地点、状态等等。
(verbose)n 不读入 mail.rc 设定档。
s 邮件标题。
c cc 抄送邮件地址。
b bcc密送邮件地址。
需要sendmail或postfix服务如果单纯的发文件文件可以用cat xxxx.txt |mail -s "主旨" abc@ fff@ 如果需要发送附件需要安装uuencode来编码 (yum install sharutils)单独发附件,这样xxxx@会收到一个data.txt的附件uuencode /tmp/data_process.log data.txt |mail xxx@如果需要正文和附件一起发:uuencode /tmp/data_process.log data.txt > /tmp/data_temp.txt系统收到邮件都会保存在“/var/spool/mail/[linux用户名]”文件中。
Java+Mail+Swing+SSL+Html+定时操作获取邮箱中的内容
1)写程序用pop3收取gmail的邮件入口参数:用户名/ 密码做一个线程,每15分钟检查一次邮箱,收取邮箱的邮件,并解码后将标题显示出来请写出程序(提示:gmail的pop3使用SSL方式,网上有完整可运行的源程序。
注意是每15分钟,不是隔15分钟)1.程序1(based on jdk1.6, jboss java mail)import javax.mail.*;import javax.mail.internet.InternetAddress;import javax.mail.internet.MimeUtility;import javax.swing.*;import java.util.Date;import java.util.Properties;import java.util.TimerTask;import java.util.Timer;import java.security.Security;import java.io.UnsupportedEncodingException;import java.awt.*;/*** @author tianbiao*/public class GMailTest extends javax.swing.JFrame {private javax.swing.JButton jButton1;private javax.swing.JLabel jLabel1;private javax.swing.JScrollPane jScrollPane1;private static javax.swing.JTextArea txt;private static StringBuilder sb = new StringBuilder("");/*** Creates new form GMailTest*/public GMailTest() {initComponents();//Check with interval as 15 minutes// TimerTask tt = new TimerTask() {// public void run() {// checkOutMails();// }// };// Timer ti = new Timer("Check out gmail items every 15 minute:");// ti.schedule(tt, 60 * 1000, 60 * 15 * 1000);//Check in every 15 minutesWorker t = new Worker();t.start();}private static void checkOutMails() {sb.append("Check at: ").append(new Date()).append("\n");String account = System.getProperty("Account");String passwd = System.getProperty("Passwd");if (null == account || null == passwd) {JOptionPane.showMessageDialog(null, "Error occur!");return;}Security.addProvider(new .ssl.internal.ssl.Provider());final String SSL_FACTORY = ".ssl.SSLSocketFactory";Properties props = System.getProperties();props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);props.setProperty("mail.pop3.socketFactory.fallback", "false");props.setProperty("mail.pop3.port", "995");props.setProperty("mail.pop3.socketFactory.port", "995");Session session = Session.getDefaultInstance(props, null);Store store = null;Folder inbox = null;URLName urln = new URLName("pop3", "", 995, null, account, passwd);try {store = session.getStore(urln);store.connect();inbox = store.getFolder("INBOX");inbox.open(Folder.READ_ONLY);FetchProfile profile = new FetchProfile();profile.add(FetchProfile.Item.ENVELOPE);Message[] messages = inbox.getMessages();inbox.fetch(messages, profile);sb.append("Total mail count: " + messages.length).append("\n");int i = 0;while (i < messages.length) {String from = decodeText(messages[i].getFrom()[0].toString());InternetAddress ia = new InternetAddress(from);sb.append("FROM:" + ia.getPersonal() + '(' + ia.getAddress() + ')').append("\n");sb.append("TITLE:" + messages[i].getSubject()).append("\n");sb.append("SIZE:" + messages[i].getSize()).append("\n");sb.append("DATE:" + messages[i].getSentDate()).append("\n\n");i++;}EventQueue.invokeLater(new Runnable() {public void run() {txt.setText(sb.toString());}});} catch (Exception ex) {ex.printStackTrace();}finally {try {inbox.close(false);} catch (Exception e) {}try {store.close();} catch (Exception e) {}}}private void initComponents() {jLabel1 = new javax.swing.JLabel();jScrollPane1 = new javax.swing.JScrollPane();txt = new javax.swing.JTextArea();jButton1 = new javax.swing.JButton();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);setTitle("Google Mail Test");this.setResizable(false);String lbl = "<html><body>Get gmail info. at fixed frequency<br><b>The application starts at " + new Date() + "</b></body></html>";jLabel1.setText(lbl);txt.setColumns(20);txt.setRows(5);jScrollPane1.setViewportView(txt);jButton1.setText("Exit");jButton1.addMouseListener(new java.awt.event.MouseAdapter() {public void mouseClicked(java.awt.event.MouseEvent evt) {jButton1MouseClicked(evt);}});javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.Gro upLayout.Alignment.LEADING).addComponent(jScrollPane1,javax.swing.GroupLayout.DEFAULT_SIZE, 480, Short.MAX_V ALUE).addComponent(jLabel1).addComponent(jButton1,javax.swing.GroupLayout.Alignment.TRAILING)).addContainerGap()));layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(19, 19, 19).addComponent(jLabel1).addPreferredGap(ponent Placement.RELATED).addComponent(jScrollPane1,javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(ponent Placement.UNRELATED).addComponent(jButton1).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_V ALUE)));pack();}private static String decodeText(String text)throws UnsupportedEncodingException {if (text == null)return null;if (text.startsWith("=?GB") || text.startsWith("=?gb"))text = MimeUtility.decodeText(text);elsetext = new String(text.getBytes("8859_1"));return text;}private void jButton1MouseClicked(java.awt.event.MouseEvent evt) { System.exit(0);}private class Worker extends Thread {private long l = 0l;private boolean stop = false;public synchronized void stopWorker() {stop = true;}public void run() {while (true) {if (stop)break;l = System.currentTimeMillis();checkOutMails();try {if (0 < 15 * 60 * 1000L - (System.currentTimeMillis() - l))Thread.sleep(15 * 60 * 1000L - (System.currentTimeMillis() - l));} catch (InterruptedException e) {e.printStackTrace();}}}}/*** @param args the command line arguments*/public static void main(String args[]) {EventQueue.invokeLater(new Runnable() {public void run() {new GMailTest().setVisible(true);}});}}2.程序2(based on jdk1.6, jboss java mail and Quartz 1.6, including 2 files) 2.1 GMailTestWithQuartz.javaimport org.quartz.*;import org.quartz.impl.StdSchedulerFactory;import java.awt.*;import java.util.Date;/*** @author tianbiao*/public class GMailTestWithQuartz extends javax.swing.JFrame { private javax.swing.JButton jButton1;private javax.swing.JLabel jLabel1;private javax.swing.JScrollPane jScrollPane1;private static javax.swing.JTextArea txt;/*** Creates new form GMailTest*/public GMailTestWithQuartz() {try {initializeTask();} catch (SchedulerException e) {e.printStackTrace();}initComponents();}private static void checkOutMails() {}private void initComponents() {jLabel1 = new javax.swing.JLabel();jScrollPane1 = new javax.swing.JScrollPane();txt = new javax.swing.JTextArea();jButton1 = new javax.swing.JButton();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);setTitle("Google Mail Test");this.setResizable(false);String lbl="<html><body>Get gmail info. at fixed frequency<br><b>The application starts at "+new Date()+"</b></body></html>";jLabel1.setText(lbl);txt.setColumns(20);txt.setRows(5);jScrollPane1.setViewportView(txt);jButton1.setText("Exit");jButton1.addMouseListener(new java.awt.event.MouseAdapter() {public void mouseClicked(java.awt.event.MouseEvent evt) {jButton1MouseClicked(evt);}});javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.Gro upLayout.Alignment.LEADING).addComponent(jScrollPane1,javax.swing.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_V ALUE).addComponent(jLabel1).addComponent(jButton1,javax.swing.GroupLayout.Alignment.TRAILING)).addContainerGap()));layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(19, 19, 19).addComponent(jLabel1).addPreferredGap(ponent Placement.RELATED).addComponent(jScrollPane1,javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap(ponent Placement.UNRELATED).addComponent(jButton1).addContainerGap(javax.swing.GroupLayout.DEFAUL T_SIZE, Short.MAX_V ALUE)));pack();}public static void setJobLog(String str){txt.setText(str);}private static void initializeTask() throws SchedulerException {// Initiate a Schedule FactorySchedulerFactory schedulerFactory = new StdSchedulerFactory();// Retrieve a scheduler from schedule factoryScheduler scheduler = schedulerFactory.getScheduler();// current timelong ctime = System.currentTimeMillis();// Initiate JobDetail with job name, job group, and executable job classJobDetail jobDetail =new JobDetail("CheckoutGMailJobDetail", "jobDetailGroup1", CheckOutGMailsJob.class);// Initiate CronTrigger with its name and group nameCronTrigger cronTrigger = new CronTrigger("cronTrigger","triggerGroup1");try {// setup CronExpressionCronExpression cexp = new CronExpression("0 0/15 * * * ?");// Assign the CronExpression to CronTriggercronTrigger.setCronExpression(cexp);} catch (Exception e) {e.printStackTrace();}// schedule a job with JobDetail and Triggerscheduler.scheduleJob(jobDetail, cronTrigger);// start the schedulerscheduler.start();}private void jButton1MouseClicked(java.awt.event.MouseEvent evt) { System.exit(0);}/*** @param args the command line arguments*/public static void main(String args[]) {EventQueue.invokeLater(new Runnable() {public void run() {new GMailTestWithQuartz().setVisible(true);}});}}2.2 CheckOutGMailsJob.javaimport org.quartz.Job;import org.quartz.JobExecutionContext;import org.quartz.JobExecutionException;import javax.mail.*;import javax.mail.internet.InternetAddress;import javax.mail.internet.MimeUtility;import javax.swing.*;import java.security.Security;import java.util.Date;import java.util.Properties;import java.awt.*;import java.io.UnsupportedEncodingException;public class CheckOutGMailsJob implements Job {private static StringBuilder sb = new StringBuilder("");public CheckOutGMailsJob() {//}public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {System.out.println(new Date());sb.append("Check at: ").append(new Date()).append("\n");String account = System.getProperty("Account");String passwd = System.getProperty("Passwd");if (null == account || null == passwd) {JOptionPane.showMessageDialog(null, "Error occur!");return;}Security.addProvider(new .ssl.internal.ssl.Provider());final String SSL_FACTORY = ".ssl.SSLSocketFactory";Properties props = System.getProperties();props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);props.setProperty("mail.pop3.socketFactory.fallback", "false");props.setProperty("mail.pop3.port", "995");props.setProperty("mail.pop3.socketFactory.port", "995");Session session = Session.getDefaultInstance(props, null);Store store = null;Folder inbox = null;URLName urln = new URLName("pop3", "", 995, null,account, passwd);try {store = session.getStore(urln);store.connect();inbox = store.getFolder("INBOX");inbox.open(Folder.READ_ONLY);FetchProfile profile = new FetchProfile();profile.add(FetchProfile.Item.ENVELOPE);Message[] messages = inbox.getMessages();inbox.fetch(messages, profile);sb.append("Total mail count: " + messages.length).append("\n");int i = 0;while (i < messages.length) {String from = decodeText(messages[i].getFrom()[0].toString());InternetAddress ia = new InternetAddress(from);sb.append("FROM:" + ia.getPersonal() + '(' + ia.getAddress() + ')').append("\n");sb.append("TITLE:" + messages[i].getSubject()).append("\n");sb.append("SIZE:" + messages[i].getSize()).append("\n");sb.append("DATE:" + messages[i].getSentDate()).append("\n\n");i++;}EventQueue.invokeLater(new Runnable() {public void run() {GMailTestWithQuartz.setJobLog(sb.toString());}});} catch (Exception ex) {ex.printStackTrace();}finally {try {inbox.close(false);} catch (Exception e) {}try {store.close();} catch (Exception e) {}}}private static String decodeText(String text)throws UnsupportedEncodingException {if (text == null)return null;if (text.startsWith("=?GB") || text.startsWith("=?gb"))text = MimeUtility.decodeText(text);elsetext = new String(text.getBytes("8859_1"));return text;}}注意:运行时按照下面的方式设置虚拟机参数:-DAccount=****** -DPasswd=*******Account是实际的gmail账户,例如abc;Passwd是对应的密码1.测试。
【转载】SpringBoot-配置发送邮件遇到的一些问题
【转载】SpringBoot-配置发送邮件遇到的⼀些问题前⾔:前⼀天调⽤163邮箱发送邮件还么有问题,今天再调⽤就各种发送不成功,害的我都关闭授权,还花了⼀⽑钱短信费重新开启授权,最后百度到了⼀篇⽂章,⾮常贴切,在此转载下。
本⼈遇到的错误代码是554,邮件主题和内容有敏感词汇(您的验证码是),或者被当作垃圾邮件,修改了⼀下主题和内容就OK了。
使⽤springboot向163邮箱发送邮件遇到⼀些问题,主要归为如下⼏点:1.连接异常,报错:.UnknownHostException: 2.⽤户权限不⾜,报错:javax.mail.AuthenticationFailedException: 550 User has no permission3.认证错误,报错:javax.mail.AuthenticationFailedException: 535 Error: authentication failed4.发送内容错误,报错:com.sun.mail.smtp.SMTPSendFailedException: 554 DT:SPM5.发送附件错误,报错:javax.mail.MessagingException: Empty multipart: multipart/related;6.发送静态图⽚资源,查看邮件,图⽚显⽰不出来问题1:详细报错如下:org.springframework.mail.MailSendException: Mail server connection failed; nested exception iscom.sun.mail.util.MailConnectException: Couldn't connect to host, port: , 25; timeout-1;nested exception is:.UnknownHostException: . Failed messages:com.sun.mail.util.MailConnectException: Couldn't connect to host, port: , 25; timeout-1;nested exception is:.UnknownHostException: ; message exception details (1) are:Failed message 1:com.sun.mail.util.MailConnectException: Couldn't connect to host, port: , 25; timeout-1;nested exception is:.UnknownHostException: at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2118)at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:712)at javax.mail.Service.connect(Service.java:366)at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:501)at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:421)at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345)at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)at mail.service.MailSendService.sendInlineMail(MailSendService.java:111)解决思路:1.进⾏telnet检查,查看telent 25,发现可以正常telent成功,说明⽹络没问题2.查看配置是否正常,经查看,发现springboot的application.properties⽂件中spring.mail.host=smtp.16后⾯有空格,去掉空格即可问题2:详细报错如下:org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception isjavax.mail.AuthenticationFailedException: 550 User has no permission at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:424) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340) at mail.service.MailSendService.sendInlineMail(MailSendService.java:111) at mail.test.TestMail.test(TestMail.java:43) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at ng.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)问题3:详细报错如下:javax.mail.AuthenticationFailedException: 535 Error: authentication failedat org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:424)at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345)at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)at mail.service.MailSendService.sendInlineMail(MailSendService.java:111)at mail.test.TestMail.test(TestMail.java:43)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)at ng.reflect.Method.invoke(Unknown Source)at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)解决思路:1.163邮箱开通smtp服务后,javaMail发送邮箱要使⽤授权码作为登录密码2.设置spring.mail.password=授权码问题4:详细报错如下:org.springframework.mail.MailSendException: Failed messages:com.sun.mail.smtp.SMTPSendFailedException: 554 DT:SPM 163 smtp11,D8CowACX7CmSHB5b3SrlCA--.26635S3 1528700051,please see /help/help_spam_16.htm?ip=182.138.102.204&hostid=smtp11&time=1528700051at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:474)~[spring-context-support-4.3.13.RELEASE.jar:4.3.13.RELEASE]at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:307)~[spring-context-support-4.3.13.RELEASE.jar:4.3.13.RELEASE]at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:296)~[spring-context-support-4.3.13.RELEASE.jar:4.3.13.RELEASE]at mail.service.MailSendService.sendSimpleMail(MailSendService.java:50) ~[classes/:na]at mail.test.TestMail.test(TestMail.java:36) [classes/:na]at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_80]at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_80]at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.7.0_80]at ng.reflect.Method.invoke(Unknown Source) ~[na:1.7.0_80]at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)[junit-4.12.jar:4.12]at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)[junit-4.12.jar:4.12]at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)[junit-4.12.jar:4.12]at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)问题5:详细报错如下:Caused by: javax.mail.MessagingException: Empty multipart: multipart/related;boundary="----=_Part_2_1115361411.1528698722005"at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:548)at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:81)... 45 more问题6:⽆报错信息解决思路:1.检查代码,具体代码如下:public boolean sendInlineMail(String fromPos, String toPos, String subject, FileSystemResource file){MimeMessage msg = mailSender.createMimeMessage();try{//MimeMessageHelper构造器,如果要发送附件邮件,必须指定multipart参数为trueMimeMessageHelper helper = new MimeMessageHelper(msg, true);helper.setFrom(fromPos);helper.setTo(toPos);helper.setSubject(subject);helper.setText("<html><body>静态资源:<img src='cid:pic' /></body></html>", true);helper.addInline("pic", file);mailSender.send(msg);}catch (MessagingException e){logger.error("发送附件邮件失败.", e);return false;}return true;}2.对代码进⾏了调整:将addInline⽅法要放在setText后⾯,进⾏测试发现正常了,可能原因是顺序如果不对,导致资源没有被正确引⽤。
e-mail常用的协议有
竭诚为您提供优质文档/双击可除e-mail常用的协议有篇一:internet技术snifferpro嗅探e-mail南京工程学院实验报告课程名称internet技术实验项目名称sniffer分析e-mail协议数据实验学生班级k软件131实验学生姓名徐智强学号240130529实验时间20xx.5.9实验地点信息楼专业机房实验成绩评定一、验目的和要求snifferpro协议分析器能获取在同一物理网络内的所有数据流量。
用sniffer分析器能获取e-mail协议数据,进行分析验证e-mail协议的命令及会话过程。
二、实验环境需装有snifferpro的一个物理网试验环境,其中有一台smtp服务器,snifferpro可运行在局域网的任何一台机器上,网络连接最好用hub且在一个子网,这样能抓到连到hub上每台机器传输的包。
版本是4.6,snifferpro软件安装非常简单,setup后一路确定即可,第一次运行时需要选择你的网卡。
、最后在win2000下运行,在win20xx下运行网络流量表有问题。
三、相关内容说明为实验方便起见,e-mail客户端用outlook,而smtp 服务器可用iis中自带的smtp服务器。
启动snifferpro,然后用outlook发送邮件,即可获取e-mail协议数据。
四、实验步骤1)首先打开outlookexpress,在上面的工具条里,找到工具菜单,点一下工具菜单,出来一系列的命令,点击一下账户。
如下图1。
图12)点击后,跳出来一个对话框,然后点击一下邮件的字样,右侧会有一个添加的按钮,点一下,又出现一个邮件的命令。
如下图2.图23)根据提示输入你的所用户名,如果没有重复的话,就会继续点下一步,接着会让你输入电子邮件地址,再点一下下一步。
如下图3.图34)又跳出一个新的命令条,这个时候,需要你输入pop 和smtp服务器的地址。
如下图4.图45)接着再点下一步,输入你的用户名和密码。
TD使用手册_翻译版zy
9、测试计划工作流(The Test Plan Workflow)对成功的应用程序测试来说,开发一个清晰并简明的测试计划是必要的基础。
一个好的测试计划,能够让你在整个测试过程的任何位置,对应用程序的质量进行评定。
本章描述了怎样使用TestDirector测试计划模块来开发测试计划。
开发一个测试计划包括如下步骤:9.1定义测试策略(Defining Testing Strategy)若想勾画一个测试策略,来达到定义在需求模块的测试需求,需要先问自己如下两个问题:你应当怎样测试你的应用程序?●你将使用哪些测试技术(压力测试、安全测试、性能和负载测试等等)?●你将怎样处理缺陷(缺陷严重等级、打开、关闭缺陷权限管理等)?你需要什么资源?●为了测试,你需要什么资源(人员、硬件等等)?●各个任务什么时候被完成?举个例子,假设一个航班预定软件,它能够让你去管理航班调动、旅客登记和机票销售。
此种情况下,手动测试和自动测试均需要。
你应该指派有编程经验的人设计自动测试,没有编程经验的人设计手动测试。
9.2定义测试主题(Defining Test Subjects)根据应该程序功能的等级关系,将应该程序功能分解为各个主题,并建造相应的表现应用程序功能的测试计划树。
测试计划树是你的测试计划的一种图形的表现。
它是根据主题组织的测试分级表,而每一个主题所包含的,就是为了实现质量要求而需要进行的测试。
例如,对于航班预定软件,你可以将Create Order、Delete Order、Open Order和Update Order 作为测试主题。
9.3设计测试(Planning Tests)为测试计划树上的每一个主题设计测试。
确定每各测试主题应该创建哪些种类的测试,如正规级别测试或回归测试。
然后在每个测试计划树的分支上创建并设计它们。
例如,在航班预定软件的Create Order测试主题下,可以包括如下的测试:Change Date、Change From Location、Change To Location、Insert New Order和Verify Insertion。
如何看懂电子邮件头
邮件头信息提供了详细的技术信息列表,如:该邮件的发件人、用于撰写该邮件的软件以及在其到达收件人途中所经过的电子邮件服务器。这些详细信息对于辨别电子邮件的问题或者辨别未经授权的商务邮件的来源非常有用。
首先,先向您介绍一下电子邮件头中的常见内容
我们以两名用户举例说明,一名用户的邮件地址是 test@,另一名用户的地址是 abc@(该用户使用 Outlook 2003)。让我们来看一下从 Abc 的帐户发送到Test的邮件。
这是在此邮件首次通过 Microsoft Exchange Server 时在此邮件上所加盖的时间戳。
由于 Internet 上未经授权的商业邮件数量已迅猛增长,因此在邮件头中提供虚假信息的行为也日益增长。这也称为欺骗。既发件人通过一些软件或者编程手法,随意修改邮件头中的信息。比如冒用他人域名以及账号,或者隐藏自己的域名等。另外,这些邮件往往是来自某种群发电子邮件服务(这种服务通过宣传方案的方式快速致富)。
From:"Υψ?"<>
Reply-To:"Υψ?"<>
To: test@
Subject: Fwd: 288??????????
Date: Wed, 28 Feb 2007 08:35:16 +0600
X-Mailer:
MIME-Version: 1.0
From: "Abc "< abc@ >
To: "Test "< test@ >
Cc:
Subject: Test mail
Date: Thu, 15 Mar 2007 13:38:31 -0800
3-发送邮件测试
1.首先在AD DC上面新建一个域用户帐号,我这里新建一个test@.这里我已经建好了,具体步骤就不多说了。
2.再进入exchange server,打开EMC控制台,我们在"recipient configuration"这里,右击选择"New mailbox".3.选择新建一个user mailbox,即用户邮箱。
当然也可以建立其它三种类型的邮箱。
room mailbox (会议室邮箱)这些邮箱是分配给会议地点(例如会议室、礼堂和培训室)的资源邮箱。
equipment mailbox(设备邮箱)这些邮箱是分配给非特定于位置的资源(例如便携式计算机投影仪、麦克风或是公司汽车)的资源邮箱。
Linked mailbox (链接邮箱)链接邮箱是由独立的受信任林中的用户访问的邮箱。
如果组织选择在资源林中部署 Exchange,则可能需要使用链接邮箱。
资源林方案使组织可以将 Exchange 集中在单个林中,同时允许使用一个或多个受信任林中的用户帐户访问Exchange 组织。
关于exchange server的详细收件人说明,请参照以下文档:/zh-cn/library/bb201680.aspx4. 我这里选择一个已经存在的用户,也就是我们刚刚新建好的test@。
5.选择这个用户test@6.好了,看到以下的选项。
这个alias,他的意思是别名,也就是邮箱的名称。
比方说我的邮箱别名是andy.gao,那么我新建好后的邮箱全名就是andy.gao@。
我这里还是使用test.7.好了,邮箱已经新建成功了,下面我们来用客户端测试一下发送邮件。
这里使用administrator邮箱给test用户发送邮件,可以看到,邮件可以收到了,成功了。
说明:本测试只是内部测试邮件,需要注意的地方有俩点,第一是新建邮箱的时候,有四种类型可取,用户可以根据自己的需要选择邮箱类型。
第二就是如果是测试接收外网邮件,需要建立相关的域名邮件MX记录。
M计划任务
计划任务先来看一下mail--用户邮件信箱用户邮箱放置的目录:/var/spool/mail/进入到mail收件箱之后可使用“?”来查看可以使用哪些命令d 删除后面接的信件号码,d10表示删除第10封邮件;d11-15表示删除第11至15封邮件。
如果要使删除生效的话还要结合“q”这个命令.s 将新建保存为文件。
如s 5 ~/mail.file表示将第5封新建保存到家目录下叫mail.file的文件中x 同exit。
不做任何操作离开mail程序。
不管你之前进行过任何删除的动作都不会生效q 离开mail程序。
会做两件事情:将刚才删除的新建移出mailbox;将刚才阅读过的信件存入~/mbox直接编辑邮件内容:[root@localhost ~]# mail -s "test" bob -->直接编写信件内容Hello,bobNice to meet you in the network.You are very nice.byebye!. -->这里是一个“.”符号Cc: liuds将文档内容输入到邮件中:[root@localhost ~]# mail -s "mailtest" bob < mailtest.txt -->将文件导入[root@localhost ~]# su - bob[bob@localhost ~]$ mailMail version 8.1 6/6/93. Type ? for help."/var/spool/mail/bob": 3 messages 3 new>N 1 root@localhost.local Tue Oct 20 12:19 20/701 "test"N 2 bob@localhost.locald Tue Oct 20 12:20 17/659 "Re: test"N 3 root@localhost.local Tue Oct 20 12:30 16/661 "mailtest"& 3 -->查看第三封邮件Message 3:From root@localhost.localdomain Tue Oct 20 12:30:21 2015Date: Tue, 20 Oct 2015 12:30:21 +0800From: root <root@localhost.localdomain>To: bob@localhost.localdomainSubject: mailtestNice to meet you! -->邮件内容,也即mailtest.txt中的内容& R -->回复邮件发送者To: root@localhost.localdomainSubject: Re: mailtestnimei! -->回复的邮件内容. -->退出Cc: -->没有要抄送的人,直接回车& x -->退出计划任务一次性的:at周期性的:crontabat使用at命令生成所要运行的工作,并将这个工作以文本文件的方式写入/var/spool/at/目录内。
Windows网络服务
常见操作题目
84、在“Server01”中, 为已建立的 “”区域设置自动更新。
参考步骤: • 参考步骤:
管理工具→ 属性→ • 管理工具→DNS→属性→允许动态更新
DHCP
动态主机配置协议(DHCP)是往网络中每台设备分配独一 无二IP地址的动态方式。之所以使用DHCP,常见理由 有: (1)降低花费在IP地址管理方面的时间和规划。 (2)降低分配IP地址的错误率。 (3)为使用户在无须更改TCP/IP配置的情况下随意 移动工作站和打印机。 (4)为使IP地址对移动用户透明
Name
主机名 域 别名 别名
Value
IP地址 权威名称服 务器 正规主机名 邮件服务器 主机名
Example {,145.37. 93.126,A} {,,NS} {,replay1.bar.fo ,CNAME} {,, MX}
文件传输协议(FTP)管理TCP/IP主机间文 件传输。FTP是TCP/IP协议组中简单然而很重 要的协议。在WWW提供文件传输更容易的方 式之前,FTP命令常被用于在机器间交换数据。 在没有使用浏览器,或者基于FTP协议的特定 文件传输软件的情况下,FTP命令依旧可以使 用。比如,如果没有Internet Explorer,则可以 FTP登录到Microsoft的服务器,把已经压缩的 程序文件下载到本地硬盘。
常见操作题目
49、有一台电脑操作系统为2000 Professional,IP地 址为192.168.1.1子网掩码为255.255.255.0,默认网 关为192.168.1.2,主DNS为192.168.1.88,备份的 DNS为192.168.1.90,现需要在这台客户机上添加第 三个DNS的地址,以增加客户机解析的冗余性。 参考步骤: • 参考步骤:
手机邮箱配置指南
手机邮箱配置指南手机邮箱用于邮件在移动设备上的收发,其主要功能在移动设备上实现:●实时或定时同步Exchange邮件、日历、联系人及任务信息;●使用智能手机编辑发送Exchange邮件、日历、联系人及任务信息;●联机查找Exchange全球通讯簿;●邮件附件可选下载;1.2.3.Windows Mobile 及以上版本操作系统手机邮箱配置说明系统在手机上的操作平台为Windows Mobile 及以上版本并且手机需开通GRPS业务功能。
一、安装配置掌上海航公文系统的证书文件在鹏程网公共信息-软件下载-业务软件-“掌上海航邮件系统证书文件”下载。
下载后解压文件,将证书拷贝至智能手机的任意地方,选中该文件,并选择“是”。
在手机上点击开始-》程序-》ActiveSync;1、点击菜单-》配置服务器,输入服务器地址:“,确保勾选上“服务器需要加密的(SSL)连接”,点击下一步;2、输入集团鹏程网帐号用户名,密码和域名“hnanet”,自动的同步需要确保勾选上“保存密码”,点击下一步;3、选择需要同步的数据,默认全部勾选上,点击“完成”,配置完毕。
4、二、使用操作说明1、在智能手机的桌面上,点击“Outlook电子邮件;……”;2、点击收件箱(1),查看同步过来的邮件;3、需要发邮件时,点击新建。
发邮件示例:输入收件人“it服务;qp_guo;xuwe;王槐”,主题“Test mail”,内容中填写“Just test from qp.”;点击菜单->检查姓名-><联机查找>,将不规范填写的收件人一一联机(连接到Exchange服务器上查找地址簿)查找出来,选中“IT服务”,点击选择,重复操作,直至收件人解析完毕;点击发送,操作完成。
4、以上的配置均采用默认配置,在GPRS网络正常连接的情况下,用户将可以实时的同步Exchange的联系人、任务、日历和收件箱信息,即在各个时段设置为“项目到达时”;5、默认收件箱同步3天以内的邮件,并截取单封邮件前面的信息;6、当用户的智能手机意外丢失时,为了让用户的个人Exchange和部分智能手机信息不致泄漏,请及时联系Exchange管理员远程清除信息。
Mail2SMS 使用手册说明书
上海迅饶自动化科技有限公司Mail2SMS使用手册目录1 前言 (1)1.1声明 (1)1.2技术支持 (1)1.3版本日志 (1)2 概述 (1)2.1功能描述 (1)2.2运行环境 (2)2.3硬件参数 (2)3 部署HMAIL服务器 (2)3.1安装H M AIL服务器 (2)3.2设置H M AIL服务器 (4)3.3重启H M AIL服务器 (7)3.4测试H M AIL服务器 (7)4 使用步骤 (9)4.1邮箱设置 (9)4.2设置用户手机信息 (10)4.3测试短信模块 (11)4.4测试语音 (12)4.5将配置好的工程文件进行保存 (13)5 硬件短信猫连接 (14)6 授权 (15)1 前言1.1声明本手册属于上海迅饶自动化科技有限公司及授权许可者版权所有,保留一切权利,未经本公司书面许可,任何单位和个人不得擅自摘抄、复制本书内容的部分或全部。
由于产品版本升级或其他原因,本手册内容有可能变更。
上海迅饶自动化科技有限公司保留在没有任何通知或者提示的情况下对本手册的内容进行修改的权利。
本手册仅作为使用指导,本公司尽全力在本手册中提供准确的信息。
1.2 技术支持●技术支持邮箱:*********************●技术支持热线电话:************●网址:1.3 版本日志2.1功能描述●Mail2SMS称作短信网关,和GPRS Modem(短信猫)硬件相结合,可以实现短信报警、短信通知、短信传输数据等功能。
另外增加的声音报警功能则可以在PC上通过扬声器将报警信息发出来。
●工作原理:在用户电脑上装一个邮件服务器,告警信息通过本地网络发送至邮箱中,然后在Mail2SMS中收取邮件信息并由GPRS Modem发送短信到用户手机上。
●优点:可配置性强,操作简单,稳定可靠,邮件信息在本地网络之间传送,不需要借助于外部网络。
2.2运行环境●支持Windows XP/2000/2003/72.3 硬件参数●短信猫(GPRS Modem)是支持GSM模式的(移动和联通2G网段的Sim卡)。
linux搭建邮件服务器
linux搭建邮件服务器邮件服务器概述使⽤Email很容易,但是Internet的邮件系统是通过很复杂的⼏个系统组成的,对于最终⽤户⽽⾔,我们熟悉的Outlook,Foxmail等都是⽤来收信和发信的,称之为MUA:Mail User Agent,邮件⽤户代理。
MUA并⾮直接将邮件发送⾄收件⼈⼿中,⽽是通过MTA:Mail Transfer Agent,邮件传输代理代为传递,Sendmail和Postfix就是扮演MTA 的⾓⾊。
⼀封邮件从MUA发出后,可能通过⼀个或多个MTA传递,最终到达MDA:Mail Delivery Agent,邮件投递代理,邮件到达MDA后,就存放在某个⽂件或特殊的数据库⾥,我们将这个长期保存邮件的地⽅称之为邮箱。
⼀旦邮件到达邮箱,就原地不动了,等⽤户再通过MUA将其取⾛,就是⽤Outlook,Foxmail等软件收信的过程。
所以⼀封邮件的流程是:发件⼈:MUA --发送–> MTA -> 若⼲个MTA… -> MTA -> MDA <–收取-- MUA:收件⼈协议:MUA到MTA,以及MTA到MTA之间使⽤的协议就是SMTP协议,⽽收邮件时,MUA到MDA之间使⽤的协议最常⽤的是POP3或IMAP。
1。
安装及配置postfix和dovecot服务关闭防⽕墙和selinux开始安装postfix和dovecotyum install postfix dovecot -y设置主机名及域名[root@mail ~]# hostnamectl set-hostname [root@mail ~]# echo '192.168.0.155 ' > /etc/hosts设置DNS服务vi /var/named/.zone$TTL 1D@ IN SOA . . (0 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimumNS .MX 5 .ns A 192.168.0.155mail A 192.168.0.155smtp CNAME mailpop3 CNAME mailwww CNAME mail[root@mail ~]# host -n -t mx 192.168.0.155Using domain server:Name: 192.168.0.155Address: 192.168.0.155#53Aliases: mail is handled by 5 . mail is handled by 10 .2.基本配置,编辑主配置⽂件[root@mail ~]# cp /etc/postfix/main.cf /etc/postfix/main.cf.bakvi /etc/postfix/main.cf // 对以下参数做修改*myhostname* //主机名myhostname =*mydomain* //使⽤邮件域mydomain = //设置本地⽹络的邮件域*myorigin* //要外发邮件时发件⼈的邮件域名myorigin = $mydomaininet_interfaces = all //设置postfix监听的⽹络端⼝mydestination = $myhostname, localhost.$mydomain, localhost,$mydomain //设置可接收邮件的主机名或域名。
TMR Tracker II与e-Tracker II设置和使用电子邮件指南:TMR Tracker
Set-up and Use of e-mail withe-Tracker II Addendum to TMR Tracker II User’s Manual and GuideThis addendum covers TMR Tracker II version 2.01.01 and e-Tracker version 2.01.01 and upWelcome to the setup Guide for using e-Tracker with your TMR Tracker Program. This guide will assist you in setting up and using this exciting new companion to the TMR Tracker system . This guide covers only the setup and use specific to the email transfer of data. All other features of the TMR Tracker program are covered in the TMR Tracker User’s Guide and Manual included on your installation CD. Please refer to that manual for detailed instructions regarding all other program features.TMR Tracker transfers data via email. An active email account is required at the Farm.TMR Tracker systems can only exchange data with authorized e-Tracker systems. This authorization uniquely identifies each TMR Tracker database by it’s unique serial number. This identification ensures that data will only be assigned to the TMR Tracker system from which it has been sent.NEW!TMR Tracker can now transfer data via email attachment or file (floppy, network, etc.).TMR Tracker can now use a date range to selectively send data files.TMR Tracker setup for use with e-TrackerStep 1TMR Tracker must be setup to utilize your email account. To access these settings, from the main menu, select Data Transfer, Your e-Mail Data.The following screen will be displayed:Enter your server name, e-mail address and password. Click Save when done.Step 2Send your data to the e-Tracker . Connect to your online account. Then select the Send Data to Nutritionist icon.A message will appear asking you to verify that you are online.At this time you do not have to be connected to the internet to build the transfer file. Select Yes to continue. The following screen will be displayed:Select Add Name.The following screen will be displayed:On this screen enter the name and e-mail address for the person you are sending to and select OK.Now select the name and click in the check box: Make Transfer File for Attachment to e-mail. Here you can either make the file for e-mail attachment to use a floppy 3.5 disk to transfer the data. Then select OK.Then select the date span for history files to send.Keep in mined the further back the date the longer itwill take to make the file.You can also select certain files to send.In most examples use All Database FilesThen select Make File.It will then work thru all of your databases anddisplay the progress on the status bar.Once it is complete this screen will disappear.Step 3Now you must open your e-mail program.Start a new message and enter the e-mail address of the person you are sending to.Then select attach. In most e-mail programs it will let you browse your computer. Here you need to go to the C:\ drive and open the TMR Tracker II folder, then open the Trans folder. Then select the Dat_2_Nt.txt file. This file stands for Data to Nutritionist. Attach the e-mail and then send.Note: There are many types of e-mail programs and each one works differently. What was explained above may not explain exactly how your program works. If you are having anyproblems with this please call Digi-Star for further support.Receiving DataOpen your e-mail program.Open the message from the sender and copy the file attachment in to the:C:\ TMR Tracker II\Trans. The selected file will be called Dat_2_Dy.txt This file stands for Data to Dairy.Once this file has been copied open TMR Tracker II.Select the Receive Data iconA message will appear asking you to verify that you are online.At this time you do not have to be connected to the internet to receive the transfer file. Select Yes to continue. The following screen will be displayed..Select the check box Import Data Transfer File With Out e-mail and select Receive. Now TMR Tracker will pull in the data back from the sender and display any messages. Then you will see your rations being updated as they flash on the screen. If there are any added rations it will display the name and then select OK to continue.Once it is done pulling in data select Done。
如何进行MD5验证-
如何进行MD5验证?篇一:MD5验证是什么?MD5验证是什么?从通俗的话讲---就好比每个人的指纹都是唯一的一样,文件的MD5值也是唯一的,效验MD5就是用来确保文件在传输过程中未被修改用的.从专业的话解释----一个 MD5 校验通过对接收的传输数据执行散列运算来检查数据的正确性.计算出的散列值拿来和随数据传输的散列值比较.如果两个值相同,说明传输的数据完整无误.没有被窜改过(前提是散列值没有被窜改),从而可以放心使用.MD5校验可以应用在多个领域,比如说机密资料的检验,下载文件的检验,明文密码的加密等MD5校验原理举例说明:如客户往我们数据中心同步一个文件,该文件使用MD5校验,那么客户在发送文件的同时会再发一个存有校验码的文件,我们拿到该文件后做MD5运算,得到的计算结果与客户发送的校验码相比较,如果一致则认为客户发送的文件没有出错,否则认为文件出错需要重新发送.篇二:发送验证邮件的三种方法在.NET中的System.Web.Mail名字空间下,有一个专门使用SMTP协议来发送邮件的类:SmtpMail,它已能满足最普通的发送邮件的需求.这个类只有一个自己的公共函数--Send()和一个公共属性—SmtpServer您必须通过SmtpServer属性来指定发送邮件的服务器的名称(或IP地址),然后再调用 Send()函数来发送邮件.第二.使用CDO组件发送邮件CDO是Collaboration Data Objects的简称,它是一组高层的COM对象集合,并经历了好几个版本的演化,现在在Windows_和E_change_中使用的都是CDO2.0的版本(分别为cdosys.dll和cdoe_.dll).CDOSYS构建在SMTP协议和NNTP 协议之上,并且作为Windows_ Server的组件被安装,您可以在系统目录(如c:\winnt或c:\windows)的system32子目录中找到它(cdosys.dll).CDO组件相对于先前介绍的SmtpMail对象功能更为丰富,并提供了一些SmtpMail类所没有提供的功能,如通过需要认证的SMTP服务器发送邮件等.下面一段代码就展示了如何使用CDO组件通过需要认证的SMTP服务器发送邮件的过程:(in C_)public void CDOsendMail(){try{CDO.Message oMsg = new CDO.Message();oMsg.From = myaccount@oMsg.To = myaccount@oMsg.Subject = MailTestoMsg.HTMLBody = html body Test /body /htmlCDO.IConfiguration iConfg = oMsg.Configuration;ADODB.Fields oFields = iConfg.Fields;oFields[ /cdo/configuration/sendusing ].V alue=2;oFields[ /cdo/configuration/sendemailaddr ess ].Value= myaccount@ //sender mailoFields[ /cdo/configuration/smtpaccountna me ].Value= myaccount@ //email accountoFields[ /cdo/configuration/sendusername ].Value= username oFields[ /cdo/configuration/sendpassword ].Value= passwordoFields[ /cdo/configuration/smtpauthentic ate ].Value=1; //value=0 代表Anonymous验证方式(不需要验证)//value=1 代表Basic验证方式(使用basic (clear-te_t) authentication. //The configuration sendusername/sendpassword or postusername/postpassword fields are used tospecify credentials.)//Value=2 代表NTLM验证方式(Secure Password Authentication in Microsoft Outlook E_press)oFields[ /cdo/configuration/languagecode ].Value=0___;oFields[ /cdo/configuration/smtpserver ]. Value= smtp._oFields.Update();oMsg.BodyPart.Charset= gb23_oMsg.HTMLBodyPart.Charset= gb23_oMsg.Send();oMsg = null;}catch (E_ception e){throw e;}}注意:由于E_change_的CDO组件cdoe_.dll会更新原有的Windows_的CDO 组件cdosys.dll,所以如果您希望继续使用cdosys.dll,您必须先通过regsrv32.e_e卸载掉cdoe_.dll.第三.使用Socket撰写邮件发送程序当然,如果您觉得SmtpMail不能满足您的需求,CDO又不够直截了当,那就只能自己动手了;其实如果您很熟悉Socket编程,自己写一个发送邮件的程序并不很难,以下就是一个例子.首先,我们简单介绍一下带验证的SMTP服务器如何使用AUTH原语进行身份验证,其详细的定义可以参考RFC2554.具体如下:1)首先,需要使用EHLO而不是原先的HELO.2)EHLO成功以后,客户端需要发送AUTH原语,与服务器就认证时用户名和密码的传递方式进行协商.3)如果协商成功,服务器会返回以3开头的结果码,这是就可以把用户名和密码传给服务器.4)最后,如果验证成功,就可以开始发信了.下面是一个实际的例子,客户端在Win_P的Command窗口中通过 telnet 25 命令连接到263的smtp服务器发信:2_ Welcome to coremail System(With Anti-Spam) 2.1EHLO 250-_2._8.30.29250-PIPELINING250-SIZE 1_4__250-ETRN250-AUTH LOGIN250 8BITMIMEAUTH LOGIN334 V_Nlcm5hbWU6b_lhY2NvdW50334 UGFzc3dvcmQ6b_lwY_Nzd29yZA==235 Authentication successfulMAIL FROM:myaccount@250 OkRCPT TO:myaccount@250 OkData354 End data with CR LF . CR LFThis is a testing email.haha..250 Ok: queued as AC5291D64_C4QUIT2_ Bye上面的内容就是发信的全过程.其中与身份验证有关的主要是第九到第十四行: AUTH LOGIN 客户端输入334 V_Nlcm5hbWU6 服务器提示〝Username:=b_lhY2NvdW50 客户端输入〝myaccount= 的Base64编码334 UGFzc3dvcmQ6 服务器提示〝Password:=b_lwY_Nzd29yZA== 客户端输入〝mypassword= 的Base64编码235 Authentication successful 服务器端通过验证从上面的分析可以看出,在这个身份验证过程中,服务器和客户端都直接通过Socket传递经过标准Base64编码的纯文本.这个过程可以非常方便的用C_实现,或者直接添加到原有的源代码中.另外,有些ESMTP服务器不支持AUTH LOGIN方式的认证,只支持AUTH CRAM-MD5方式验证.但是这两者之间的区别只是文本的编码方式不同.实现此功能的源代码可以在 /projects/opensmtp-net/ 上找到下载.下面给出了一个简单的伪码:public void SendMail(MailMessage msg){NetworkStream nwstream = GetConnection();WriteToStream(ref nwstream, EHLO + smtpHost + \r\nstring welcomeMsg = ReadFromStream(ref nwstream);// implement HELO command if EHLO is uecognized.if (IsUnknownCommand(welcomeMsg)){WriteToStream(ref nwstream, HELO + smtpHost + \r\n}CheckForError(welcomeMsg, ReplyConstants.OK);// Authentication is used if the u/p are suppliedAuthLogin(ref nwstream);WriteToStream(ref nwstream, MAIL FROM: + msg.From.Address + \r\n CheckForError(ReadFromStream(ref nwstream), ReplyConstants.OK);SendRecipientList(ref nwstream, msg.To);SendRecipientList(ref nwstream, );SendRecipientList(ref nwstream, msg.BCC);WriteToStream(ref nwstream, DATA\r\nCheckForError(ReadFromStream(ref nwstream), ReplyConstants.START_INPUT);if ( != null .Length != 0){ WriteToStream(ref nwstream, Reply-To: \ + + \ + msg.ReplyTo.Address + \r\n }else{ WriteToStream(ref nwstream, Reply-To: + msg.ReplyTo.Address + \r\n } if ( != null .Length != 0){ WriteToStream(ref nwstream, From: \ + + \ + msg.From.Address + \r\n }else{ WriteToStream(ref nwstream, From: + msg.From.Address + \r\n }WriteToStre篇三:单片机常用校验方法常见校验算法一.校验算法奇偶校验(单字节奇偶校验和多字节奇偶校验)MD5校验求校验和BCC(Block Check Character/信息组校验码),常说的异或校验方法CRC(Cyclic Redundancy Check/循环冗余校验)LRC(Longitudinal Redundancy Check/纵向冗余校验)二.奇偶校验内存中最小的单位是比特,也称为〝位〞,位有只有两种状态分别以1和0来标示,每8个连续的比特叫做一个字节(byte).不带奇偶校验的内存每个字节只有8位,如果其某一位存储了错误的值,就会导致其存储的相应数据发生变化,进而导致应用程序发生错误.而奇偶校验就是在每一字节(8位)之外又增加了一位作为错误检测位.在某字节中存储数据之后,在其8个位上存储的数据是固定的,因为位只能有两种状态1或0,假设存储的数据用位标示为1.1. 1.0.0.1.0.1,那么把每个位相加(1+1+1+0+0+1+0+1=5),结果是奇数,那么在校验位定义为1,反之为0.当CPU读取存储的数据时,它会再次把前8位中存储的数据相加,计算结果是否与校验位相一致.从而一定程度上能检测出内存错误,奇偶校验只能检测出错误而无法对其进行修正,同时虽然双位同时发生错误的概率相当低,但奇偶校验却无法检测出双位错误三.MD5校验MD5的全称是Message-Digest Algorithm 5,在90年代初由MIT的计算机科学实验室和RSA Data Security Inc 发明,由 MD2/MD3/MD4 发展而来的.MD5的实际应用是对一段Message(字节串)产生fingerprint(指纹),可以防止被〝篡改〞.举个例子,天天安全网提供下载的MD5校验值软件WinMD5.zip,其MD5值是1e_ab3591d25583eff5_9293dc98d2,但你下载该软件后计算MD5 发现其值却是8_95f50b94bb4891a4ce4ffb6ccf64b,那说明该ZIP已经被他人修改过,那还用不用该软件那你可自己琢磨着看啦.四.求校验和求校验和其实是一种或运算.如下://-------------------------------------------------------------------------------------------------- //如下是计算校验位函数// checkdata,包括起始位在内的前九位数据的校验和//-------------------------------------------------------------------------------------------------- unsigned char CLU_checkdata(void){ //求校验和unsigned char checkdata=0;for(point=0;point 9,TI=1;point++){checkdata=checkdata | buffer[point];}return(checkdata);}四.BCC(Block Check Character/信息组校验符号)BCC校验其实是奇偶校验的一种,但也是经常使用并且效率较高的一种,所谓BCC校验法(block check character),就是在发送前和发送后分别把BCC以前包括ET_字符的所有字符按位异或后,按要求变换(增加或前去一个固定的值)后所得到的字符进行比较,相等即认为通信无错误,不相等则认为通信出错.非接触卡读卡器与PC机的通讯格式如下:ST_(_H)+ 6个字节的卡号+VERH+VERL+EOT(_H)ST_(_H)起始字节EOT(_H)结束字节6个字节的卡号为六个十六进制的ASCII字符,6个字节的传送,高字节在前,低字节在后.例如:卡号:8 D E F 9 E传输的数据格式:38 44 45 46 39 45(十六进制)在校验时采用目前最通用的BCC校验方式:具体的方法是:将有效的卡号接字节作异或(_OR)校验:38H (_OR)44H (_OR)45H (_OR)46H (_OR)39H(_OR)45H =_H 然后将接收到的数据VERH+VERL合成一个字节数据,30H(HE_)=0,33H(HE_)=3 合成数据为_H,接收到的数据与我们收到的卡号的校验数据一致,则接收到的卡号为正确卡号.再比如现有卡号为:卡号:0 5 8 E 4 2传输的数据格式:30 35 38 45 34 32 (十六进制)在校验时采用目前最通用的BCC校验方式:具体的方法是:将有效的卡号接字节作异或(_OR)校验:30H (_OR)35H (_OR)38H (_OR)45H (_OR)34H(_OR)32H =7EH 然后将接收到的数据VERH+VERL合成一个字节数据,37H(HE_)=7,45H(HE_)=E 合成数据为7EH,接收到的数据与我们收到的卡号的校验数据一致,则接收到的卡号为正确卡号.在编写程序时,可以先将所有数据都接收到计算机的内存中,然后计算BCC校验值VALUE1,再将接收的BCC值拼成一个十六进制数VALUE2,然后比较这两个值,如果相等,则接收到的卡号为合法卡号,然后按您的系统作相应的处理.VB代码如下:Public Function bcc(a As String) As StringDim b As Integerb = 0For i = 1 To Len(a) Step 2b = b _or ( h + Mid(a, i, 2))Ne_tb = b And HFFIf b _ Thenbcc = 0 + He_(b)Elsebcc = He_(b)End IfEnd Function五.CRC(Cyclic Redundancy Check/循环冗余校验)CRC 校验的基本思想是利用线性编码理论,在发送端根据要传送的k位二进制码序列,以一定的规则产生一个校验用的监督码(既CRC码)r位,并附在信息后边,构成一个新的二进制码序列数共(k+r)位,最后发送出去.在接收端,则根据信息码和CRC码之间所遵循的规则进行检验,以确定传送中是否出错._位的CRC码产生的规则是先将要发送的二进制序列数左移_位(既乘以)后,再除以一个多项式,最后所得到的余数既是CRC码.它是利用除法及余数的原理来作错误侦测(Error Detecting)的.实际应用时,发送装置计算出CRC值并随数据一同发送给接收装置,接收装置对收到的数据重新计算CRC并与收到的CRC相比较,若两个CRC值不同,则说明数据通讯出现错误.根据应用环境与习惯的不同,CRC又可分为以下几种标准:①CRC-_码;②CRC-_码;③CRC-CCITT码;④CRC-32码.CRC-_码通常用来传送6-bit字符串.CRC-_及CRC-CCITT码则用是来传送8-bit字符,其中CRC-_为美国采用,而CRC-CCITT为欧洲国家所采用.CRC-32码大都被采用在一种称为Point-to-Point的同步传输中.下面为CRC计算过程:1.设置CRC寄存器,并给其赋值FFFF(he_).2.将数据的第一个8-bit字符与_位CRC寄存器的低8位进行异或,并把结果存入CRC寄存器.3.CRC寄存器向右移一位,MSB补零,移出并检查LSB.4.如果LSB为0,重复第三步;若LSB为1,CRC寄存器与多项式码相异或.5.重复第3与第4步直到8次移位全部完成.此时一个8-bit数据处理完毕. 6.重复第2至第5步直到所有数据全部处理完成.7.最终CRC寄存器的内容即为CRC值.常用的CRC循环冗余校验标准多项式如下:CRC(_位) = __+__+_2+1CRC(CCITT) = __+__ +_5+1CRC(32位) = _32+_26+_23+__+__+__+__+_8+_7+_5+_4+_2+_+1 以CRC(_位)多项式为例,其对应校验二进制位列为1 1_0 __ __ __. CRC基本原理是:在K位信息码后再拼接R位的校验码,整个编码长度为N位,因此,这种编码又叫(N,K)码.对于一个给定的(N,K)码,可以证明存在一个最高次幂为N-K=R的多项式G(_),根据G(_)可以生成K位信息的校验码,而G(_)叫做这个CRC 码的生成多项式.校验码的具体生成过程为:假设发送信息用信息多项式C(_)表示,将C(_)左移R位,则可表示成C(_)_2R,这样C(_)的右边就会空出R位,这就是校验码的位置.通过C(_)_2R除以生成多项式G(_)得到的余数就是校验码.几个基本概念1.多项式与二进制数码多项式和二进制数有直接对应关系:_的最高幂次对应二进制数的最高位,以下各位对应多项式的各幂次,有此幂次项对应1,无此幂次项对应0.可以看出:_的最高幂次为R,转换成对应的二进制数有R+1位.多项式包括生成多项式G(_)和信息多项式C(_).如生成多项式为G(_)=_4+_3+_+1, 可转换为二进制数码__1.而发送信息位 __,可转换为数据多项式为C(_)=_3+_2+_+1.2.生成多项式是接受方和发送方的一个约定,也就是一个二进制数,在整个传输过程中,这个数始终保持不变.在发送方,利用生成多项式对信息多项式做模2除生成校验码.在接受方利用生成多项式对收到的编码多项式做模2除检测和确定错误位置.应满足以下条件:a.生成多项式的最高位和最低位必须为1.b.当被传送信息(CRC码)任何一位发生错误时,被生成多项式做模2除后应该使余数不为0.c.不同位发生错误时,应该使余数不同.d.对余数继续做模2除,应使余数循环.将这些要求反映为数学关系是比较复杂的.但可以从有关资料查到常用的对应于不同码制的生成多项式如图9所示:N K 码距d G(_)多项式 G(_)7 4 3 _3+_+1 1_17 4 3 _3+_2+1 __7 3 4 _4+_3+_2+1 _1_7 3 4 _4+_2+_+1 1___ _ 3 _4+_+1 1___ 7 5 _8+_7+_6+_4+_____3_6 3 _5+_2+__1_3_1 5 __+_9+_8+_6+_5+_3+1 _1_1__16357 3 _6+_+1 1___6351 5 __+__+_5+_4+_2+1 1______1_1 1_4 __+__+_2+1 _______1_3.模2除(按位除)模2除做法与算术除法类似,但每一位除(减)的结果不影响其它位,即不向上一位借位.所以实际上就是异或.然后再移位移位做下一位的模2减.步骤如下:a.用除数对被除数最高几位做模2减,没有借位.b.除数右移一位,若余数最高位为1,商为1,并对余数做模2减.若余数最高位为0,商为0,除数继续右移一位.c.一直做到余数的位数小于除数时,该余数就是最终余数.CRC校验程序编写:编写CRC校验程序有两种办法:一种为计算法,一种为查表法.下面对两种方法分别讨论.①计算法计算法就是依据CRC校验码的产生原理来设计程序.其优点是模块代码少,修改灵活,可移植性好.其缺点为计算量大.为了便于理解,这里假定了三位数据,而多项式码为A_1(he_).在窗体上放置一命令按钮Command1,并添加如下代码:Private Sub Command1_Click()Dim CRC() As ByteDim d() As Byte 待传输数据ReDim d(2) As Byted(0) = _3d(1) = _2d(2) = _5CRC = CRC_(d) 调用CRC_计算函数CRC(0)为高位CRC(1)为低位End Sub注意:在数据传输时CRC的低位可能在前,而高位在后.Function CRC_(data() As Byte) As StringDim CRC_Lo As Byte, CRC_Hi As Byte CRC寄存器Dim CL As Byte, CH As Byte 多项式码 HA_1Dim SaveHi As Byte, SaveLo As ByteDim i As IntegerDim Flag As IntegerCRC_Lo = HFFCRC_Hi = HFFCL = H1 多项式码低位 H_CH = HA0 多项式码高位 HA0For i = 0 To UBound(data)CRC_Lo = CRC_Lo _or data(i) 每一个数据与CRC寄存器进行异或For Flag = 0 To 7SaveHi = CRC_HiSaveLo = CRC_LoCRC_Hi = CRC_Hi \ 2 高位右移一位CRC_Lo = CRC_Lo \ 2 低位右移一位If ((SaveHi And H1) = H1) Then 如果高位字节最后一位为1CRC_Lo = CRC_Lo Or H80 则低位字节右移后前面补1End If 否则自动补0If ((SaveLo And H1) = H1) Then 如果LSB为1,则与多项式码进行异或CRC_Hi = CRC_Hi _or CHCRC_Lo = CRC_Lo _or CLEnd IfNe_t Flag。
Outlook express错误代码常见问题处理方法
2、换一联机品质较佳的ISP)
0x800CCC0A 邮线下载未完成
0x800CCC0B 服务器忙碌中
0x800CCC0D 找不到主机(检查你的SMTP服务器是不是设错)
0x800CCC0E 联机到服务器失败,无法与主机建立联机。等一段时间再试。或者用ping 等网络命令测试一下看看能否连的x800C013E
可能是 Folders.dbx 档案属性错误或损坏.
0x800CCC00
身份验证(Authentication)未载入
0x800CCC01
认证(Certificate)内容错误
0x800CCC02
认证日期错误
0x800CCC03
使用者已联机
解决方法:收件箱超过2G,可备份或者删除多余的邮件,或者将 收件箱.dbx重命名为old.dbx。或者新建一个收件夹,把一些信分批移动过去。
0x800CCC90
登入邮件服务器发生错误,检查一下您是不是有使用该服务器的权限。或者:不需要安全密码认证登入,但却设了安全密码认证登入
2、只要是有附件的mail,都没法收,一收就报错。
3、里面的文件夹打不开,或者是打开了却什么mail都看不到,但是在资源管理器中看.dbx文件(比如说是“收件箱.dbx”)却占了很大的空间。
4、收到较大邮件,经过较长时间的等待,最后Outlook Express报错。在服务器上删除了较大的邮件后,小文件就可以收了,但遇到大文件后又不可以了当你使用OutLook Express时出现无法打开收件箱,无法查阅收件箱中内容等一系列问题(错误号:0x800C0133 )。
testme 用法
testme 用法
testme是一个用于测试的工具,可以帮助开发人员在软件开发过程中进行单元测试和集成测试。
它提供了一系列的命令和选项,以便用户灵活地进行测试和调试。
使用testme进行测试的步骤非常简单。
首先,您需要将测试代码编写好并保存为一个或多个测试文件。
接下来,通过命令行或集成开发环境(IDE)来运行testme。
指定要测试的代码文件路径,testme会自动执行测试并生成相应的测试报告。
testme支持多种测试方法,包括单元测试和集成测试。
对于单元测试,testme可以为每个函数或方法编写测试用例,并检查它们的输出是否符合预期。
对于集成测试,testme可以模拟不同的环境和条件,并测试整个系统的功能和性能。
除了测试代码本身,testme还可以生成测试覆盖率报告,帮助开发人员评估测试的质量和覆盖范围。
它可以显示每个源代码文件中被测试覆盖的行数和百分比,帮助开发人员找出可能存在的代码缺陷。
testme还支持测试用例的自动化执行,可以通过配置文件或脚本来批量运行测试,提高测试效率和准确性。
此外,testme还提供了灵活的测试参数设置,可以根据不同的测试场景和需求进行配置。
testme是一个功能强大、易于使用的测试工具,可以帮助开发人员快速、准确地进行软件测试。
无论是单元测试还是集成测试,testme都可以满足您的需求并提供可靠的测试结果。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
* 文件: MialTool.cpp
* 描述: 邮件收发示例程序,制台应用程序
* 时间: 2006.2.28
*/
#include "smapi.h"
#define MAX_CMD_LEN 100
#define MAX_INPUT_LEN 1024
{
cout << _T( "初始化mapi32.dll库失败" ) << endl;
return 0;
}
// 登陆默认邮件服务器
if ( !mapiCtrl.Logon() )
{
cout << _T( "登陆默认邮件服务器失败" ) << endl;
CMAPI::FreeLib();
#define cout_CMD 5
char CmdList[ cout_CMD ][ MAX_CMD_LEN ] = { _T( "send" ),
_T( "getfirst" ),
}
else {
cout << _T( "接收邮件成功" ) << endl;
// 读取信件内容
if ( mapiCtrl.ReadMail( strTitle, strText, strAddr, strTime ) )
{
// 输出信件内容
cout << _T( "邮件主题:\t\t" ) << strTitle.str( )
<< _T( "\n邮件发送地址:\t ") << strAddr.str()
<< _T( "\n邮件发送时间:\t ") << strTime.str()
<< _T( "\n邮件内容:\n ") << strText.str() << _T( "\n" ) << endl;
#define CMD_SEND 0
#define CMD_GET_FIRST 1
#define CMD_GET_NEXT 2
#define CMD_HELP 3
#define CMD_QUIT 4
}
else
{
cout << _T( "读取邮件失败" ) << endl;
}
}
return TRUE;
}
/*
* 描述: 发送邮件接收函数,读取并打印当前服务器中的下一封信件
* 返回: 如果需要退出程序,则返回 FALSE, 否则返回 TRUE
}
/*
* 描述: 打印帮助信息
*/
void Usage( void )
{
cout << _T( "命令及格式列举如下:\n\n ")
<< CmdList[ CMD_QUIT ] << _T( "\t\t退出本次登陆\n ")
<< CmdList[ CMD_GET_FIRST ] << _T( "\t用于下载第一封邮件\n " )
szAccessories[ MAX_PATH - 1 ] = 0;
// 验证是否缺少参数
if ( szTitle[ 0 ] == '\0' || szText[0] == '\0' || szAddr[ 0 ] == '\0' )
{
cout << _T( "请按正确格式输入命令" ) << endl;
{
Usage( );
return TRUE;
}
// 输入的第一个字符串是 "send"
if ( !strnicmp( token, CmdList[ CMD_SEND ], MAX_CMD_LEN ) )
{
return SendMail( strInput );
return 0;
}
else
{
cout << _T( "打印帮助请输入help" ) << endl;
}
TCHAR szInput[MAX_INPUT_LEN];
BOOL bRet;
// 循环获取输入,并调用ParseCommandA 函数分析输入字符串,直到ParseCommandA 函数返回 FALSE
* 参数: 输入 strInput 参数序列数据流
* 返回: 如果需要退出程序,则返回 FALSE, 否则返回 TRUE
*/
BOOL SendMail( istringstream &strInput )
{
char szTitle[MAX_PATH], szText[MAX_INPUT_LEN], szAddr[MAX_PATH], szAccessories[MAX_PATH];
do
{
// 输出命令提示符
cout << _T( "\nMAIL>" );
// 获取输入的一行字符串
cin.getline( szInput, MAX_INPUT_LEN );
szInput[ MAX_INPUT_LEN - 1 ] = _T( '0' );
istringstream strInput( szInput );
cout << _T( "接收邮件成功" ) << endl;
// 读取信件内容
if ( mapiCtrl.ReadMail( strTitle, strText, strAddr, strTime ) )
{
// 输出信件内容
cout << _T( "邮件主题:\t\t ") << strTitle.str()
// 读取参数
strInput >> szTitle >> szText >> szAddr >> szAccessories;
szTitle[ MAX_PATH - 1 ] = 0;
szText[ MAX_INPUT_LEN - 1 ] = 0;
szAddr[ MAX_PATH - 1 ] = 0;
{
ostringstream strTitle, strText, strAddr, strTime;
// 查找第一封信
if ( !mapiCtrl.FindFirst( ) )
{
cout << _T( "接收邮件失败,请确认邮箱配置是否正确 ") << endl;
}
else {
if ( !strnicmp(token, CmdList[ CMD_GET_NEXT ], MAX_CMD_LEN) )
{
return GetNextMail( );
}
}
cout << "非法命令,打印帮助信息请输入help" << endl;
return TRUE;
_T( "getnext" ),
_T( "help" ),
_T( "quit" ) };
*/
BOOL GetNextMail( void )
{
ostringstream strTitle, strText, strAddr, strTime;
// 查找第一封信
if ( !mapiCtrl.FindNext( ) )
{
cout << _T( "接收邮件失败,请确认邮箱配置是否正确或邮箱中是否有邮件" ) << endl;
}
// 输入的第一个字符串是 "getfirst"
if ( !strnicmp( token, CmdList[ CMD_GET_FIRST ], MAX_CMD_LEN) )
{
return GetFirstMail( );
}
// 输入的第一个字符串是 "getnext"
{
char token[ MAX_INPUT_LEN ];
strInput >> token;
if ( token[ 0 ] == '\0' )
{
return TRUE;
}
if ( strlen(token) < MAX_CMD_LEN )
{
// 输入的第一个字符串是 "quit"
<< CmdList[ CMD_GET_NEXT ] << _T( "\t\t用于下载下一封邮件\n" )
<< CmdList[ CMD_SEND ] << _T( " <标题> <正文> <接收地址> [附件存放路径]\t用于发送邮件" )