带附件的邮箱发送
来源:互联网 发布:淘宝消除模块间隙代码 编辑:程序博客网 时间:2024/05/01 06:00
using System;
using System.Collections.Generic;
using System.Web;
using System.Net.Mail;
using System.Text;
using System.Configuration;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class sendmail : System.Web.UI.Page
{
//带附件发送
public static bool SendMailsf(string fromUser, string fromUserName, string toUser, string toUserName, string cc, string subjectNm, string bodyAll, string fj)
{
bool ret = false;
try
{
//Attachment objMailAttachment;
//创建一个附件对象
//objMailAttachment = new Attachment("d:\\test.txt");//发送邮件的附件
objMailAttachment = new Attachment(fj);//发送邮件的附件
MailMessage mm = new MailMessage();
mm.From = new MailAddress(fromUser, fromUserName, Encoding.UTF8);
mm.To.Add(toUser);
string[] listc = null;
try
{
if (cc != null && cc != "")
{
listc = cc.Split(',');
for (int i = 0; i < listc.Length; i++)
{
mm.CC.Add(listc[i].ToString());
}
}
}
catch (Exception list)
{
throw list;
}
mm.Attachments.Add(objMailAttachment);//将附件附加到邮件消息对象中
mm.Subject = subjectNm;
mm.SubjectEncoding = Encoding.UTF8;
mm.Body = bodyAll;
mm.BodyEncoding = Encoding.UTF8;
mm.IsBodyHtml = true;
//mm.Priority = MailPriority.High;//加急邮件!
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential("帐号", "密码");
client.Host = "主机";
client.Send(mm);
ret = true;
}
catch (Exception ex)
{
throw ex;
}
return ret;
}
}
- 带附件的邮箱发送
- 发送带附件的邮件
- 带附件的邮件发送
- 用Linux C来实现发送带html和附件(word)的邮件到邮箱
- Java实现自动发送带附件的邮件(网易邮箱为例)
- Android发送邮件到指定邮箱(可带附件)
- java 发送邮件(qq邮箱作为发件箱,带附件)
- C#邮箱、附件发送
- 用 VFP 发送带附件的电子邮件
- 用JavaMail发送带附件的邮件
- 用JavaMail发送带附件的邮件
- 用JavaMail发送带附件的邮件
- c#发送带附件的邮件
- 使用javamail发送带附件的邮件
- 使用javamail发送带附件的邮件
- php 发送带附件的邮件
- 命令行下发送带附件的邮件
- javamail 发送 带附件的 html邮件
- 将Open SSH Server 移植到ARM Linux成功
- Android checkBox简单使用
- 系统缓冲区、内核缓冲区、IO库操作本身的缓冲区 之间联系
- 两个月小结(7中旬 ~ 9中旬 )
- 【Itext】7步制作Itext5页眉页脚pdf实现第几页共几页
- 带附件的邮箱发送
- Ubuntu下,在Eclipse中使用JNI调用ffmpeg
- HRESULT各种返回值的含义
- Java 网络编程
- wmi使用的win32类库名
- 关于备份、恢复过程中的一些概念
- MongoDB基本使用
- java编程思想笔记--字符串部分一
- 语音变声器(男女互变) 中文安装版免费