The main is to record the following methods, easy to find in the future;
Public stringGetsendemail (string from,stringTo,stringSmtpstringPasswordstringSubjectstringbody) { Try{logrecord.write (NULL,"From :"+ from+"; To:"+ to +"; SMTP:"+ SMTP +";p Assword:"+ Password +"; Subject:"+subject); Logrecord.write (NULL,"the body parameter is:"+body); varBodyarr = body. Split ('|'); if(Bodyarr.length! = One) {Logrecord.write (NULL,"Give"+ to +"E -mail status: Parameter data is not correct"); return "the data for the body parameter is not correct"; } varBodyall =@"<div class= ' main ' > <p class= ' tx_center ' ><span>xx Group interview notice </span></p> <p>"+ bodyarr[0] +@"Hello! Thank you for your interest in our company! Your resume has been through our preliminary screening, we are inviting you to come to our company to attend the interview. </p> <p> Your job interview is: <span class= ' Color_r ' >"+ bodyarr[1] +@"</span></p> <p> Your interview time is: <span class= ' Color_r ' >"+ bodyarr[2] +@"<span class= ' color_r ' ></span></p> <p> interview considerations: <span class= ' Color_r ' >"+ bodyarr[3] +@"</span><span class= ' color_r ' ></span></p> <p> interview Venue: <span class= ' Color_r ' > "+ bodyarr[4] +@"</span></p> <p> Company address: <span class= ' Color_r ' >"+ bodyarr[5] +@"</span></p> <p> bus route: <span class= ' Color_r ' >"+ bodyarr[6] +@"</span></p> <p><span class= ' color_r ' > Simple map: <br/>"+ bodyarr[7] +@"'/></span></p> <p> please come on time! If you have any questions or changes, please call us at:"+ bodyarr[8] +@", contact person:"+ bodyarr[9] +@"or email description, thank you! </p> <p> Rui Xiang Group profile:</p> <p> Company website:"+ bodyarr[Ten] +@"</p></div>"; Logrecord.write (NULL,"the contents are:"+Bodyall); varMessage =NewMailMessage ( from, to, subject, Bodyall) {bodyencoding=Encoding.default, isbodyhtml=true, Priority=Mailpriority.high}; Logrecord.write (NULL,"before sending"); varClient =Newsmtpclient (SMTP) {usedefaultcredentials=false, Deliverymethod=Smtpdeliverymethod.network, Credentials=NewSystem.Net.NetworkCredential ( from, password)}; Client. Send (message); Logrecord.write (NULL,"Give"+ to +"E- Mail status: True"); return "true"; } Catch(Exception e) {logrecord.write (E, e.message); returnE.message; } }
Implementation of the C # send mail feature