发送126的邮箱失败,麻烦各位帮忙看下什么原因造成的?

gymls2003 2007-08-23 02:25:43

MailMessage mail = new MailMessage();
mail.Body="世界你好!";
mail.BodyEncoding=System.Text.Encoding.UTF8;
mail.BodyFormat=MailFormat.Text;
mail.From="aa@126.com";
mail.To="bb@126.com";
mail.Priority = MailPriority.High;
mail.Subject = "工资发放";

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //这个好像是认证类型
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","aa"); //要认证的用户名
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "123456"); //要认证的密码

try
{
// SmtpMail.SmtpServer="smpt.126.com";
SmtpMail.SmtpServer.Insert(0,"smpt.sohu.com");
SmtpMail.Send(mail);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}

在事件查看器里面报这个错误:
向远程域 '126.com' 传递邮件失败。错误消息为 'An SMTP protocol error occurred.
'。 引起此错误的 SMTP 动作为 'MAIL'。远程服务器 的响应为 '553 Requested action not taken: no smtp MX only,mx13,wKjJwbCrtwf_Js1GAbxzEQ==.951S2 1187849983
'。

在aa@126.com这个油箱里面产生一个这样的错误:
Delivery Status Notification (Failure)
This is an automatically generated Delivery Status Notification.

Delivery to the following recipients failed.

bb@126.com



如果把收件人改为yahoo或者sohu的邮箱,没问题可以发出去!但对其他的有些邮箱也发不出去,比如公司的内部邮箱,其他的有些网站邮箱等,大家遇见类似的问题吗?麻烦指点一下!,谢谢!
...全文
1540 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
li365941471 2009-10-13
  • 打赏
  • 举报
回复
对了,补充下,新浪的邮箱是可以的。不信,你试试新浪的。
li365941471 2009-10-13
  • 打赏
  • 举报
回复
因为网易现在不行了,除非是前几年申请的邮箱。
mygisforum 2009-10-10
  • 打赏
  • 举报
回复
笔记中的一段,希望有用。

使用说明:
代码为控制台应用程序,设置步骤:新建控制台应用程序,复制、粘贴,改下的邮箱账号、密码及附件,然后定位到“项目属性——调试——启动选项——命令行参数”处,
输入 "smtp.126.com" 25。按 F5 即可到邮箱查看内容啦!


using System;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
using System.Threading;
using System.ComponentModel;
namespace Examples.SmptExamples.Async
{
public class SimpleAsynchronousExample
{
static bool mailSent = false;
private static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
{
// Get the unique identifier for this asynchronous operation.
String token = (string)e.UserState;
if (e.Cancelled)
{
Console.WriteLine("[{0}] Send canceled.", token);
}
if (e.Error != null)
{
Console.WriteLine("[{0}] {1}", token, e.Error.ToString());
}
else
{
Console.WriteLine("Message sent.");
}
mailSent = true;
}
public static void Main(string[] args)
{
// Command line argument must the the SMTP host.
SmtpClient client = new SmtpClient(args[0],Convert.ToInt32(args[1]));
// Specify the e-mail sender.
// Create a mailing address that includes a UTF8 character
// in the display name.
/*
* 有些 SMTP 服务器要求在代表客户端发送电子邮件之前验证客户端的身份
* 解决办法:
* 下面一行是非常关键的代码
*/
client.Credentials = new NetworkCredential("自己账号", "登陆密码");
MailAddress from = new MailAddress("自己账号@126.com",
"Jane " + (char)0xD8 + " Clayton",
System.Text.Encoding.UTF8);
// Set destinations for the e-mail message.
MailAddress to = new MailAddress("对方账号@126.com");
// Specify the message content.
MailMessage message = new MailMessage(from, to);
message.Body = "This is a test e-mail message sent by an application. ";
// Include some non-ASCII characters in body and subject.
string someArrows = new string(new char[] { '\u2190', '\u2191', '\u2192', '\u2193' });
message.Body += Environment.NewLine + someArrows;
message.BodyEncoding = System.Text.Encoding.UTF8;
message.Subject = "test message 1" + someArrows;
message.SubjectEncoding = System.Text.Encoding.UTF8;

/*
* 添加附件
*/
message.Attachments.Add(new Attachment(@"e:\daemon.log"));

// Set the method that is called back when the send operation ends.
client.SendCompleted += new
SendCompletedEventHandler(SendCompletedCallback);
// The userState can be any object that allows your callback
// method to identify this send operation.
// For this example, the userToken is a string constant.
string userState = "test message1";
client.SendAsync(message, userState);
Console.WriteLine("Sending message... press c to cancel mail. Press any other key to exit.");
string answer = Console.ReadLine();
// If the user canceled the send, and mail hasn't been sent yet,
// then cancel the pending operation.
if (answer.StartsWith("c") && mailSent == false)
{
client.SendAsyncCancel();
}
// Clean up.
message.Dispose();
Console.WriteLine("Goodbye.");
}
}
}
gymls2003 2007-08-23
  • 打赏
  • 举报
回复


MailMessage mail = new MailMessage();
mail.Body="世界你好!";
mail.BodyEncoding=System.Text.Encoding.UTF8;
mail.BodyFormat=MailFormat.Text;
mail.From="aa@126.com";
mail.To="bb@126.com";
mail.Priority = MailPriority.High;
mail.Subject = "工资发放";

mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //这个好像是认证类型
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername","aa"); //要认证的用户名
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "123456"); //要认证的密码

try
{

SmtpMail.SmtpServer.Insert(0,"smpt.126.com");
SmtpMail.Send(mail);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}

在事件查看器里面报这个错误:
向远程域 '126.com' 传递邮件失败。错误消息为 'An SMTP protocol error occurred.
'。 引起此错误的 SMTP 动作为 'MAIL'。远程服务器 的响应为 '553 Requested action not taken: no smtp MX only,mx13,wKjJwbCrtwf_Js1GAbxzEQ==.951S2 1187849983
'。

在aa@126.com这个油箱里面产生一个这样的错误:
Delivery Status Notification (Failure)
This is an automatically generated Delivery Status Notification.

Delivery to the following recipients failed.

bb@126.com
csShooter 2007-08-23
  • 打赏
  • 举报
回复
自己建一个邮箱服务器来测试!

111,094

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧