邮件组件集合MailBee Objects发送电子邮件教程(一):排除故障

MailBee Objects是一个组件集合。您可以使用该控件创建并将邮件发送到SMTP服务器并从POP3服务器接收、解析以及删除电子邮件,还能在IMAP4服务器上管理电子邮件以及文件夹。它同样支持SSL以及S/MIME以获得更好的安全性能。MailBee控件能在ASP、VB、C++或任何支持ActiveX技术的语言中使用。

最新版MailBee Objects


常见的消息未发送原因为以下因素之一:

  • 服务器需要SMTP身份验证
  • 身份验证失败(用户名和/或密码错误,身份验证方法不受支持)。您可以尝试几种常见的选择:
    • UserName =帐户名(例如,如果您的电子邮件地址为jdoe@domain.com,则为jdoe)
    • UserName =电子邮件地址(例如jdoe@domain.com)
    • 为AuthMethod属性尝试其他值(例如1、2、3、4、5)
  • 指定的服务器不是SMTP(在这种情况下为ErrCode = 4)。例如,jdoe@domain.com的SMTP服务器名称通常有点像mail.domain.com或smtp.domain.com,而不仅仅是domain.com。
  • SMTP服务器拒绝来自您IP地址的连接
  • SMTP服务器被防火墙阻挡
  • 指定的发件人:该服务器不允许该地址
  • 指定收件人:仅当用户已经通过SMTP身份验证时,该地址才被允许
  • 超出消息大小限制,超出每个连接的流量限制等。

    您可以从MailBee的日志文件中确定问题的确切原因。要启用日志记录,请设置SMTP对象的EnableLogging和LogFilePath属性。以下示例使用SMTP验证发送简单的电子邮件。SMTP会话日志被写入C: smtp_log.txt文件中。

Visual Basic

Dim objSMTPSet objSMTP = CreateObject("MailBee.SMTP")' Enable logging SMTP session into a fileobjSMTP.EnableLogging = TrueobjSMTP.LogFilePath = "C:smtp_log.txt"objSMTP.ClearLogobjSMTP.LicenseKey = "put your license key here"' Set SMTP server nameobjSMTP.ServerName = "mail.server.com"' Enable SMTP authenticationobjSMTP.AuthMethod = 2' Set authentication credentialsobjSMTP.UserName = "jdoe"objSMTP.Password = "secret"' Set message propertiesobjSMTP.FromAddr = "sender@firstdomain.com"objSMTP.ToAddr = "recipient@seconddomain.com"objSMTP.Subject = "Test"objSMTP.BodyText = "Body of the test message"' Try to send messageIf objSMTP.Send Then  MsgBox "Sent successfully"Else  MsgBox "Error #" & objSMTP.ErrCode & ", " & objSMTP.ErrDescEnd If

ASP:

<%Dim objSMTPSet objSMTP = Server.CreateObject("MailBee.SMTP")' Enable logging SMTP session into a fileobjSMTP.EnableLogging = TrueobjSMTP.LogFilePath = "C:smtp_log.txt"objSMTP.ClearLogobjSMTP.LicenseKey = "put your license key here"' Set SMTP server nameobjSMTP.ServerName = "mail.server.com"' Enable SMTP authenticationobjSMTP.AuthMethod = 2' Set authentication credentialsobjSMTP.UserName = "jdoe"objSMTP.Password = "secret"' Set message propertiesobjSMTP.FromAddr = "sender@firstdomain.com"objSMTP.ToAddr = "recipient@seconddomain.com"objSMTP.Subject = "Test"objSMTP.BodyText = "Body of the test message"' Try to send messageIf objSMTP.Send Then  Response.Write "Sent successfully"Else  Response.Write "Error #" & objSMTP.ErrCode & ", " & objSMTP.ErrDescEnd If%>

以上就是本次教程的全部内容,接下来会有更多相关教程,敬请关注!您也可以在评论留下你的经验和建议。

除了本教程,想要了解更多电子邮件相关产品信息的可以点击此处查看。有更多教程资源等着你!

==========================================

如果想要购买正版授权MailBee.NET Objects的朋友,可以联系在线客服

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2020年1月1日
下一篇 2020年1月1日

相关推荐

发表回复

登录后才能评论