mailhelper -------mail帮助类
代码如下:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mail;
/// <summary>
///mailhelper 的摘要说明
/// </summary>
public class mailhelper
{
public mailhelper()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
/// <summary>
/// 邮件发送操作
/// </summary>
/// <param name="Addressee">收件人地址</param>
/// <param name="From">发件人地址</param>
/// <param name="sendpassword">发件人密码</param>
/// <param name="Copy">抄送人地址</param>
/// <param name="secret">密送人地址</param>
/// <param name="Subject">发送主题</param>
/// <param name="Attachment">附件信息</param>
/// <param name="Body">邮件内容</param>
public string SendeEmal(string Addressee, string From, string sendpassword, string Copy, string secret, string Subject, string Attachment, string Body)
{
MailMessage objMailMessage;
MailAttachment objMailAttachment;
// 创建邮件消息
objMailMessage = new MailMessage();
//发件人EMAIL
objMailMessage.From = From;//源邮件地址
//收件人EMAIL
objMailMessage.To = Addressee; //目的邮件地址
//邮件抄送
objMailMessage.Cc = Copy;
//邮件misong
objMailMessage.Bcc = secret;
//邮件主题
objMailMessage.Subject = Subject; //发送邮件的标题
//邮件内容
objMailMessage.Body = Body;//发送邮件的内容
// 创建一个附件对象
if (Attachment != "")
{
objMailAttachment = new MailAttachment(Attachment);//发送邮件的附件 c://test.txt
新闻热点
疑难解答
图片精选