日期:2014-05-18  浏览次数:20378 次

急急急!求一般邮件(163,新浪)的写邮件代码
比如说写邮件的时候有立即发送和存为草稿,这个要怎么写代码,请教各位大虾。。。。。。

------解决方案--------------------
C# code


using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;

namespace MBACSC.DataAccess
{
    public class SendMail
    {
        /// <summary>
        /// Net 2.0 发送邮件
        /// </summary>
        /// <param name="strSmtpServer">发送邮件服务器</param>
        /// <param name="strFrom">发信人Email</param>
        /// <param name="strFromPass">发信人Email密码</param>
        /// <param name="strTo">收信人Email</param>
        /// <param name="strSubject">邮件主题</param>
        /// <param name="strBody">邮件内容</param>
        public static void Send(string strSmtpServer, string strFrom, string strFromPass, string strTo, string strSubject, string strBody)
        {
            SmtpClient client = new SmtpClient(strSmtpServer);

            client.UseDefaultCredentials = false;
            client.Credentials = new System.Net.NetworkCredential(strFrom, strFromPass);
            client.DeliveryMethod = SmtpDeliveryMethod.Network;

            Byte[] b = Encoding.Default.GetBytes(strBody);
            strBody = Encoding.GetEncoding("gb2312").GetString(b).ToString();

            MailMessage message = new MailMessage(strFrom, strTo, strSubject, strBody);

            message.BodyEncoding = Encoding.UTF8;
            message.IsBodyHtml = true;

            client.Send(message);
        }
    }
}

------解决方案--------------------
mark!
------解决方案--------------------
http://www.cnblogs.com/wang123/archive/2007/07/09/811512.html