邮件问题啊 简单邮件发送需要服务器验证

mmiiaaoo 2003-08-31 12:31:57
大家能否给我事例 vb版啊


大出血啊 全压上50分 别说分少
我就怎么点啊
大家救命要紧啊
...全文
227 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
waki 2003-09-10
  • 打赏
  • 举报
回复
使用这种方式实现有缺陷的,它的前提条件是邮件服务器上安装的是MS的EXCHANGE,这样才可以使用它的CDO对象来进行验证。而现在网上大部分的邮件服务器都装的不是这个,所以实际上是不可行的。除非是在企业应用中。
可以使用我做的邮件发送控件,支持验证,发送附件,可以使用VB或者C#语言调用。还可以得到我以后的更新升级。下载地址:www.aspxcontrol.com
Surpass 2003-09-10
  • 打赏
  • 举报
回复
友情UP
mmiiaaoo 2003-09-10
  • 打赏
  • 举报
回复
你的控件我已经使用过了啊
怎么不行啊
ArLi2003 2003-09-05
  • 打赏
  • 举报
回复
http://www.zpcity.com/arli/commonprj/cls_Mail.cs

ps: 0x0804 是语言代码,过去是没有内置const 的,都是自己const 或者 incude *.h 文件,所以有些人直接用int 值
mmiiaaoo 2003-09-05
  • 打赏
  • 举报
回复
Dim objmailmessage As New MailMessage
Dim from As String
from = "web@zdsw.com"
objmailmessage.From = from
objmailmessage.To = TextBox2.Text
objmailmessage.Subject = "欢迎成为浙东商务网的会员,下面是你的登陆密码!你可以在我的办公室里修改密码!"
objmailmessage.Body = "请以" & "ID:" + TextBox1.Text + ",密码:" + strpasswd + ",登录浙东商务网"
'objmailmessage.BodyFormat = MailFormat.Html


objmailmessage.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'如果用smtp(Server用外部的, 请您把SendUsing设为2, 内部设为1)
objmailmessage.Fields("http://schemas.microsoft.com/cdo/configuration/sendemailaddress") = from

objmailmessage.Fields("http://schemas.microsoft.com/cdo/configuration/smtpaccountname") = from
objmailmessage.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = from
objmailmessage.Fields("http://schemas.microsoft.com/cdo/configuration/cdoSMTPServerPort") = 25
objmailmessage.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "8833633"
objmailmessage.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
'value=0 代表Anonymous验证方式(不需要验证)
'value=1 代表Basic验证方式(使用basic (clear-text) authentication.
'The configuration sendusername/sendpassword or postusername/postpassword fields are used to specify credentials.)
'Value=2 代表NTLM验证方式(Secure Password Authentication in Microsoft Outlook Express)
objmailmessage.Fields("http://schemas.microsoft.com/cdo/configuration/languagecode") = " 0x0804"
objmailmessage.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "zdsw.com.cn"




SmtpMail.Send(objmailmessage)
mmiiaaoo 2003-09-04
  • 打赏
  • 举报
回复
0x0804
什么意思啊
我做了出现代码错误啊
那用什么代码呢
mmiiaaoo 2003-09-04
  • 打赏
  • 举报
回复
("http://schemas.microsoft.com/cdo/configuration/smtpserver")
什么意思啊
cnhgj 2003-09-04
  • 打赏
  • 举报
回复
帮你转成VB的

public sub SMTPSendMail(strSmtpServer as String,strFrom as string strFromPass as string,strto as string,strsubject as string,strBody as string)
dim myMail as MaiMessage = new MailMessage
myMail.From = strFrom
myMail.To = strto
MyMail.Subject = strSubject
myMail.Priority = Mailpriority.Low
myMail.BodyFormat = MailFormat.Text
myMail.Body = strBody
myMail.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
myMail.Fields("http://schemas.microsoft.com/cdo/configuration/sendemailaddress") = strFrom
myMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpaccountname") = strFrom
myMail.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = strFrom
myMail.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strFromPass
myMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
myMail.Fields("http://schemas.microsoft.com/cdo/configuration/languagecode") = 0x0804
myMail.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmtpServer
SmtpMail.Send(myMail)
end sub
mmiiaaoo 2003-08-31
  • 打赏
  • 举报
回复
申明服务器不是本机啊
carper 2003-08-31
  • 打赏
  • 举报
回复
vb.net 写的没有,C# 倒有一个,懒得转换了。

/// <summary>
/// 使用远程需要密码验证的mail服务器发送Email的函数
/// </summary>
/// <param name="strSmtpServer">远程服务器名</param>
/// <param name="strFrom">默认发送人</param>
/// <param name="strFromPass">发送人验证密码</param>
/// <param name="strto">发送到</param>
/// <param name="strSubject">主题</param>
/// <param name="strBody">内容</param>
/// <permission cref="System.Security.PermissionSet">private</permission>
private static void SMTPSendMail(string strSmtpServer,string strFrom,string strFromPass,string strto,string strSubject,string strBody)
{
MailMessage myMail=new MailMessage();
myMail.From = strFrom;
myMail.To = strto;
myMail.Subject = strSubject;
myMail.Priority = MailPriority.Low;
myMail.BodyFormat = MailFormat.Text;
myMail.Body = strBody;
// 每个值对应说明看:
//http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_cdoconfiguration_module.asp
myMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2;
//如果用smtp Server用外部的,请您把SendUsing设为2,内部设为1
myMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"] = strFrom;
myMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"] = strFrom;
myMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = strFrom;
myMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = strFromPass;
myMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
//value=0 代表Anonymous验证方式(不需要验证)
//value=1 代表Basic验证方式(使用basic (clear-text) authentication.
//The configuration sendusername/sendpassword or postusername/postpassword fields are used to specify credentials.)
//Value=2 代表NTLM验证方式(Secure Password Authentication in Microsoft Outlook Express)
myMail.Fields["http://schemas.microsoft.com/cdo/configuration/languagecode"] = 0x0804;
myMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = strSmtpServer;
SmtpMail.Send(myMail);
}

62,039

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

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