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

谁知道如何用.Net和smtpClient发送base64编码的邮件?
谁知道如何用.Net和smtpClient发送base64编码的邮件?

比如下边代码该如何修改?谢谢!!!

private void SendEmail(int i)
  {
  SmtpClient smtpClient = new SmtpClient();
  MailMessage message = new MailMessage();

  MailAddress fromAddress = new MailAddress("junxu3@163.com");

  smtpClient.Host = "smtp.163.com";
  smtpClient.Port = 25;

  message.From = fromAddress;
  message.To.Add("Pptest8@163.com");
  message.Subject = System.Environment.MachineName + "-" + txtSubject.Text + " - kanamacrotest #" + i.ToString();
  message.IsBodyHtml = false;
   

  StringBuilder strMessage = new StringBuilder();

  strMessage.AppendLine("Server: " + System.Environment.MachineName);
  strMessage.AppendLine(txtBody.Text);
  strMessage.AppendLine("Time: " + DateTime.UtcNow.ToString());

  message.Body = strMessage.ToString();

  smtpClient.Send(message);
  }


------解决方案--------------------
可以试试
System.Net.Mime.TransferEncoding.Base64

使用AlternateView 类

参见代码
http://stackoverflow.com/questions/1456815/problem-sending-email-with-smtpclient-in-c-sharp
------解决方案--------------------
http://blog.xiaohuochai.net/post-66.html