这样能发送吗?
admin 发表于 2010-04-21 | 来源:互联网 | 阅读:
SmtpClient client = new SmtpClient();
client.Send("85145645@qq.com", "12554324557@qq,com", "哈哈", "收到了没?");
Console.WriteLine("成功{0}", "1254634435@qq,com");
SmtpClient client = new SmtpClient();
client.Send("85145645@qq.com", "12554324557@qq,com", "哈哈", "收到了没?");
Console.WriteLine("成功{0}", "1254634435@qq,com");
评论功能因故关闭!
请加入我们的QQ群一起参与讨论:群号59400482(500人超级群)
肯定不行的,需要用户名和密码……
不能吧,你连服务器和登录信息都没写,正常的是这样:SmtpClient client = new SmtpClient(server);client.Credentials = new System.Net.NetworkCredential(fromemail, password);client.Send(message);
public void MailSend(string MailFrom,string MailTo,string MailPwd,string Mailtitle,string MailCon) { MailMessage MyMail = new MailMessage(); MyMail.From = new MailAddress("", ""); MyMail.To.Add(new MailAddress("")); MyMail.Subject = Mailtitle; MyMail.Body = MailCon; MyMail.IsBodyHtml = false; SmtpClient smtpclient = new SmtpClient(); smtpclient.DeliveryMethod = SmtpDeliveryMethod.Network; smtpclient.Host = ""; smtpclient.Credentials = new System.Net.NetworkCredential(MailFrom, MailPwd); smtpclient.Send(MyMail); } jmail.Message Jmail = new jmail.Message(); DateTime t = DateTime.Now; String Subject = ""; String body = ""; String FromEmail = ""; String ToEmail = ""; Jmail.Charset = "GB2312"; Jmail.ContentType = "text/html"; Jmail.AddRecipient(ToEmail, "", ""); Jmail.From = FromEmail; Jmail.MailServerUserName = ""; Jmail.MailServerPassWord = ""; Jmail.Subject = Subject; Jmail.ContentType="text/html"; Jmail.Body = body + t.ToString(); Jmail.Send("", false); Jmail.Close();
public void MailSend(string MailFrom,string MailTo,string MailPwd,string Mailtitle,string MailCon) { MailMessage MyMail = new MailMessage(); MyMail.From = new MailAddress("", ""); MyMail.To.Add(new MailAddress("")); MyMail.Subject = Mailtitle; MyMail.Body = MailCon; MyMail.IsBodyHtml = false; SmtpClient smtpclient = new SmtpClient(); smtpclient.DeliveryMethod = SmtpDeliveryMethod.Network; smtpclient.Host = ""; smtpclient.Credentials = new System.Net.NetworkCredential(MailFrom, MailPwd); smtpclient.Send(MyMail); } jmail.Message Jmail = new jmail.Message(); DateTime t = DateTime.Now; String Subject = ""; String body = ""; String FromEmail = ""; String ToEmail = ""; Jmail.Charset = "GB2312"; Jmail.ContentType = "text/html"; Jmail.AddRecipient(ToEmail, "", ""); Jmail.From = FromEmail; Jmail.MailServerUserName = ""; Jmail.MailServerPassWord = ""; Jmail.Subject = Subject; Jmail.ContentType="text/html"; Jmail.Body = body + t.ToString(); Jmail.Send("", false); Jmail.Close(); 好的很那
望各位指教