try
{
CDO.MessageClass Mail=new CDO.MessageClass();
Mail.To=this.TBTo.Text;
Mail.CC=this.TBCc.Text;
Mail.BCC=this.TBBcc.Text;
Mail.Subject=this.TBSubject.Text;
Mail.From=User.Identity.Name;
Mail.TextBody=this.FreeTextBox1.Text;
string userID=User.Identity.Name.Trim();
string strPassword=DAL.Data.UserModel.SelectByUserId(userID).Password.Trim();
string[] filename=this.TBAttachment.Value.ToString().Split(new char[] {','});
foreach(string s in filename)
{
if(s!=String.Empty)
{
Mail.AddAttachment(Server.MapPath("MailAttachment/"+s),userID,strPassword);
}
}
Mail.Send();
Response.Write("<script>alert(\"邮件已发送成功\")</script>");
}
catch(Exception ex)
{
Response.Write("<script>alert(\""+ex.Message+"\")</script>");
}|
cdoSendUsingPickup |
1 |
Send message using the local SMTP service pickup directory. |
|
cdoSendUsingPort |
2 |
Send the message using the network (SMTP over the network). |