高分求jamil邮件发送问题!着急!!
private void Button1_Click(object sender, System.EventArgs e)
{
myJmail.MessageClass jmail=new myJmail.MessageClass();
jmail.Silent =true;
jmail.Logging=true;
jmail.MailServerPassWord = "19830811 ";
jmail.MailServerUserName = "suhuiyong_2000@sina.com ";
jmail.Charset= "GB2312 ";
jmail.Priority =Convert.ToByte(1);
jmail.ContentType= "text/html ";
jmail.AddRecipient( "suhuiyong_2000@sina.com ", " ", " ");
jmail.From = "suhuiyong_2000@sina.com ";
jmail.FromName = "suhuiyong_2000@sina.com ";
jmail.Body = "asdfdsf ";
jmail.Subject = "asdfdsf ";
if(jmail.Send( "smtp.sina.com ",false))
Label1.Text = "邮件发送成功! ";
else
Label1.Text = "发送失败! ";
jmail.Close();
}
public bool sendMail()
{
MessageClass email = new MessageClass();
email.Logging = true;
email.Silent = true;
email.MailServerUserName = "suhuiyong_2000@sina.com ";
email.MailServerPassWord = "19830811 ";
email.From = "suhuiyong_2000@sina.com ";
email.Subject = "jmail ";
// email.AddAttachment( "c:\\test.xml ",true, " ");
email.Body = "test jmail send mail ";
email.AddRecipient( "suhuiyong_2000@sina.com ", "abc ", null);
return email.Send( "mail.sina.com ", false) ;
}
}
代码写好了,就是发不成邮件,大侠给看看啊!要不就疯了,
------解决方案--------------------CS文件
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Web.Util;
using jmail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSend_Click(object sender, EventArgs e)
{
sendEmail(txtSender.Text.Trim(), txtSUser.Text.Trim(), txtEUser.Text.Trim(), txtEPwd.Text.Trim(), txtReceiver.Text.Trim(), txtSubject.Text.Trim(), txtContent.Text.Trim(), txtEServer.Text.Trim());
}
public void sendEmail(string sender, string senderuser, string euser, string epwd, string receiver, string subject, string body, string eserver)
{
jmail.MessageClass jmMessage = new jmail.MessageClass();
jmMessage.Charset = "GB2312 ";
jmMessage.ISOEncodeHeaders = false;
jmMessage.From = sender;
jmMessage.FromName = senderuser;
jmMessage.Subject = subject;
jmMessage.MailServerUserName = euser;