發送:
public void sendMail()
{
Message jmessage = new MessageClass();
jmessage.Charset = "GB2312";
jmessage.From = "[email protected]";
jmessage.FromName = "流淚的魚";
jmessage.ReplyTo = "[email protected]";
jmessage.Subject = "test email from jmessage";
jmessage.AddRecipIEnt("[email protected]", "魚魚", "G");
jmessage.Body = "jmail 內容";
jmessage.AddAttachment("E:\\myJamil.dll", true, "dll");
jmessage.MailServerUserName = "xxxxxxx";
jmessage.MailServerPassWord = "xxxxxxx";
jmessage.Send("SMTP.163.COM", false);
//MessageBox.Show("email sent successfully!");
jmessage.Close();//注意這裡,一定要關閉連接 否則郵件發不出去
}
接收:
private void getMail()
{
Message msg = null;
//POP3 pop = new POP3Class();
myJmail.POP3Class pop = new POP3Class();
pop.Connect("zwwwm", "yuyu19870622", "POP3.163.COM", 110);
int id= pop.GetLastUnreadMessage();
msg = pop.Messages[id];
&nb