public void Send(string strSmtpServer, string strFrom, string strPassword, string strTo, string strSubject, string strBody)
{
Configuration conf = new ConfigurationClass();
conf.Fields[CdoConfiguration.cdoSendUsingMethod].Value = CdoSendUsing.cdoSendUsingPort;
//conf.Fields[CdoConfiguration.cdoSendEmailAddress].Value = strFrom;
conf.Fields[CdoConfiguration.cdoSMTPServer].Value = strSmtpServer;
conf.Fields[CdoConfiguration.cdoSendUserName].Value = strFrom;
conf.Fields[CdoConfiguration.cdoSendPassword].Value = strPassword;
//发送者名称,这一项要注意检查,不可以乱写
conf.Fields[CdoConfiguration.cdoSMTPServerPort].Value = 25;
conf.Fields[CdoConfiguration.cdoSMTPAuthenticate].Value
= CdoProtocolsAuthentication.cdoBasic;
conf.Fields.Update(); MessageClass mail = new MessageClass();
mail.Configuration = conf;
mail.To = strTo;
mail.From = strFrom;
mail.Subject = "OK";
mail.TextBody = "OK";
//mail.CC = txtCC.Text;
//mail.BCC = txtBCC.Text;
//string strPath = Cache["Path"].ToString();
//mail.AddAttachment(strPath, "wacle", "storm");//添加附件功能
try
{
mail.Send();
MessageBox.Show("发送成功");
}
catch (Exception err)
{
throw (new Exception(err.Message));
} }
我用上面的函数发送邮件,奇怪的是,我用A邮箱发送邮件到B邮箱(新开的邮箱),发送成功。但从B邮箱发送到A邮箱就提示:“邮件无法发送到 SMTP 服务器。传输错误代码为 0x80040217。服务器响应为 not available”不知道为什么?不知道大家是否遇到过这样的问题。
{
Configuration conf = new ConfigurationClass();
conf.Fields[CdoConfiguration.cdoSendUsingMethod].Value = CdoSendUsing.cdoSendUsingPort;
//conf.Fields[CdoConfiguration.cdoSendEmailAddress].Value = strFrom;
conf.Fields[CdoConfiguration.cdoSMTPServer].Value = strSmtpServer;
conf.Fields[CdoConfiguration.cdoSendUserName].Value = strFrom;
conf.Fields[CdoConfiguration.cdoSendPassword].Value = strPassword;
//发送者名称,这一项要注意检查,不可以乱写
conf.Fields[CdoConfiguration.cdoSMTPServerPort].Value = 25;
conf.Fields[CdoConfiguration.cdoSMTPAuthenticate].Value
= CdoProtocolsAuthentication.cdoBasic;
conf.Fields.Update(); MessageClass mail = new MessageClass();
mail.Configuration = conf;
mail.To = strTo;
mail.From = strFrom;
mail.Subject = "OK";
mail.TextBody = "OK";
//mail.CC = txtCC.Text;
//mail.BCC = txtBCC.Text;
//string strPath = Cache["Path"].ToString();
//mail.AddAttachment(strPath, "wacle", "storm");//添加附件功能
try
{
mail.Send();
MessageBox.Show("发送成功");
}
catch (Exception err)
{
throw (new Exception(err.Message));
} }
我用上面的函数发送邮件,奇怪的是,我用A邮箱发送邮件到B邮箱(新开的邮箱),发送成功。但从B邮箱发送到A邮箱就提示:“邮件无法发送到 SMTP 服务器。传输错误代码为 0x80040217。服务器响应为 not available”不知道为什么?不知道大家是否遇到过这样的问题。
解决方案 »
- WPF如何改变combobox里的scrollbar的位置
- 如何避免窗口死锁
- 【讨论】经典的,用于学习的开源项目有哪几个?
- 求,把big endian转换成little endian的C#源码!!
- 奇怪正则
- 对象名 'mekir_1.f_cid' 无效
- 如何获得HTML加密后的代码
- 发布维护全局变量问题
- 大家幫幫忙吧
- 发生类型为 System.StackOverflowException 的异常 是怎么回事??
- 请高手指教!急用!!!如何用递归实现n个数相加和等于一个固定数,然后把所有符合条件的组合都输出
- axWindowsMediaPlayer_PlayStateChange什么时候会触发啊?
在转发时,有些邮箱服务器,特别是免费的,会限制smtp服务器的功能,你看看是不是这个原因
我把你说的A、B邮箱理解为不同的服务器
[email protected]
[email protected]