总结13发送email.docx

上传人:牧羊曲112 文档编号:3521462 上传时间:2023-03-13 格式:DOCX 页数:7 大小:38.11KB
返回 下载 相关 举报
总结13发送email.docx_第1页
第1页 / 共7页
总结13发送email.docx_第2页
第2页 / 共7页
总结13发送email.docx_第3页
第3页 / 共7页
总结13发送email.docx_第4页
第4页 / 共7页
总结13发送email.docx_第5页
第5页 / 共7页
亲,该文档总共7页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《总结13发送email.docx》由会员分享,可在线阅读,更多相关《总结13发送email.docx(7页珍藏版)》请在三一办公上搜索。

1、总结13发送emailEmail发送代码 1. C#代码发送类 using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Net.Mail; using Sys

2、tem.Web.Configuration; using System.Collections.Generic; namespace WBIS.Base.Fun / / funSentEmail 的摘要描述 / public class funSentEmail public static string Error; / / / / 发送人 / 接收人 / 主题 / 内容 / 主机或服务器 / 端口 / public static bool SendEmail(string ToEmail, string Subject, string Body) bool Success = false;

3、try string FromEmail = Constant.strEmaiFrom; string host = Constant.strMailserver; int port = Constant.intPort; System.Net.Mail.SmtpClient client; if (port != 0) client = new SmtpClient(host, port); else client = new SmtpClient(host); /client.Credentials = new System.Net.NetworkCredential(Ki, 123456

4、); /string inceptMail = WebConfigurationManager.AppSettingsek_InceptMail.ToString; /MailMessage message = new MailMessage; /message.Bcc.Add(inceptMail); /message.From = new MailAddress(FromEmail); /message.To.Add(ToEmail); MailAddress from = new MailAddress(FromEmail); MailAddress to = new MailAddre

5、ss(ToEmail); MailMessage message = new MailMessage(from, to); message.Subject = Subject; message.Body = Body; message.IsBodyHtml = true; client.Send(message); Success = true; catch (Exception ex) Error = ex.Message; Success = false; return Success; / / 发送email / / 发送人 / 接收人 / 主题 / 内容 / 主机或服务器 / 端口 /

6、 附件的地址 / public static bool SendEmail(string ToEmail, string Subject, string Body, string strFiler) bool Success = false; if (!System.IO.File.Exists(strFiler) return false; try string FromEmail = Constant.strEmaiFrom; string host = Constant.strMailserver; int port = Constant.intPort; System.Net.Mail

7、.SmtpClient client; if (port != 0) client = new SmtpClient(host, port); else client = new SmtpClient(host); MailAddress from = new MailAddress(FromEmail); MailAddress to = new MailAddress(ToEmail); MailMessage message = new MailMessage(from, to); message.Subject = Subject; message.Body = Body; messa

8、ge.IsBodyHtml = true; Attachment data = new Attachment(strFiler); message.Attachments.Add(data); client.Send(message); Success = true; catch (Exception ex) Error = ex.Message; Success = false; return Success; 2. asp代码通过JMAIL进行发送 如果服务器没有注册jmail,需要注册jmail:将jamil.dll组件复制到系统所在的磁盘的system32活页夹下,然后执行“开始”-“

9、运行”命令,在弹出的“运行”对话框中输入regsvr32 jmail.dll end if end if 3. asp上传控件的使用 如果服务器没有注册AspUpload上传组件,需要注册AspUpload:安装aspupload.exe,安装完成后,在安装路径下找AspUploadBin把AspUpload.dll复制到系统所在的磁盘的system32活页夹下,然后执行“开始”-“运行”命令,在弹出的“运行”对话框中输入regsvr32 AspUpload.dll 需要设定form提交的属性 ENCTYPE=multipart/form-data 如: maintain_meteor_up.

10、asp页面是进行上传的动作 在maintain_meteor_up.asp页的主要代码: Set Upload = Server.CreateObject(Persits.Upload.1) Upload.SetMaxSize 50000, False Upload.OverwriteFiles = True Upload.Save(server.mappath(images) filename=Upload.Files(meteo_Flash).filename usid=trim(Upload.form(sch0).value) sno=trim(Upload.form(sno).value) on error resume next

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号