asp.net使用jmail接收外部邮件
最近我们公司要接收外部邮件
功能都差不多都实现了,不过一个很奇怪的问题就是设置了163的邮箱之后,但是我用jamil接受到的邮件并不会全部的接收
很多邮件都会接收失败!例如
service@51cto.com,info@mail1.dianping.com,很多企业邮件都接收不了,但是个别的有可疑接收,我目前只可以接收到卓越网的企业邮件,但是如果是163的邮件又可以接受的到,就连QQ邮箱都接收不到,请问jamil接收外部邮件还需要什么特别的设置吗??? 请大家看看!!!谢谢.....
方法在这里面
private bool webf_pop3_mail(DateTime dt_pop, string ls_server, int in_pop, string user, string password, ref string arg_msg)
{
bool rslt = true;
jmail.POP3Class popmail = new jmail.POP3Class();//建立收邮件对象
jmail.Message mailmessage; //建立邮件信息接口
jmail.Attachments atts;//建立附件集接口
jmail.Attachment att;//建立附件接口
popmail.Connect(user, password, ls_server, in_pop);
string ls_sql = "select isnull(max(pop_senddate),0) as date_time from oa_pop_msg where pop_inmail='" + user.Trim() + "' and pop_opid=" + Session["opid"].ToString().Trim() + " and pop_issend=0 ";
DataTable dt = cs_con.Select(ls_sql, null, ref arg_msg).Tables[0];
DateTime d_time = dt_pop;
if (dt.Rows[0]["date_time"].ToString().Trim() != "1900-1-1 0:00:00")
{
d_time = Convert.ToDateTime(dt.Rows[0]["date_time"]);
}
int billid = 0;
int num = 0;
string mail_billid = "";
if (popmail.Count > 0)
{
for (int i = 1; i <= popmail.Count; i++) //根据取到的邮件数量依次取得每封邮件
{
using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromSeconds(Convert.ToInt32(Application["timeoutSecond"]))))
{
try
{
mailmessage = popmail.Messages[i]; //取得一条邮件信息
string ls_msg_date = mailmessage.Headers.Text;
if (mailmessage.Headers.Text.IndexOf("From:") - mailmessage.Headers.Text.IndexOf("Date:") - 12 > 0)
{
ls_msg_date = mailmessage.Headers.Text.Substring(mailmessage.Headers.Text.IndexOf("Date:") + 5, mailmessage.Headers.Text.IndexOf("From:") - mailmessage.Headers.Text.IndexOf("Date:") - 12).Trim();
}
else
{
ls_msg_date = mailmessage.Headers.Text.Substring(mailmessage.Headers.Text.IndexOf("Date:") + 5, mailmessage.Headers.Text.IndexOf("To:") - mailmessage.Headers.Text.IndexOf("Date:") - 12).Trim();
}
DateTime dt_date = Convert.ToDateTime(ls_msg_date);
if (dt_date > d_time)
{
if (!new_id.tryGetNewID("oa_pop_msg", "pop_billid", ref billid, ref arg_msg))
{
rslt = false;
arg_msg = "接收是ID参生失败!";
scope.Dispose();
goto ext_webf_pop3_mail;
}
atts = mailmessage.Attachments; //取得该邮件的附件集合
mailmessage.Charset = "UTF-8"; //设置邮件的编码方式
mailmessa