Troubleshooting

Visual Basic Code | ASP Code

Common reason of the messages not being sent is one of the following: You can determine exact reason of the problem from MailBee's log file. To enable logging, set EnableLogging and LogFilePath properties of the SMTP object.

This sample sends simple e-mail using SMTP authentication. SMTP session log is written into "C:\Temp\smtp_log.txt" file.

[Visual Basic]:

Dim objSMTP

Set objSMTP = CreateObject("MailBee.SMTP")

' Enable logging SMTP session into a file
objSMTP.EnableLogging = True
objSMTP.LogFilePath = "C:\Temp\smtp_log.txt"
objSMTP.ClearLog

objSMTP.LicenseKey = "put your license key here"

' Set SMTP server name
objSMTP.ServerName = "mail.server.com"

' Enable SMTP authentication
objSMTP.AuthMethod = 2

' Set authentication credentials
objSMTP.UserName = "jdoe"
objSMTP.Password = "secret"

' Set message properties
objSMTP.FromAddr = "sender@firstdomain.com"
objSMTP.ToAddr = "recipient@seconddomain.com"
objSMTP.Subject = "Test"
objSMTP.BodyText = "Body of the test message"

' Try to send message
If objSMTP.Send Then
  MsgBox "Sent successfully"
Else
  MsgBox "Error #" & objSMTP.ErrCode & ", " & objSMTP.ErrDesc
End If

[ASP]:

<%
Dim objSMTP

Set objSMTP = Server.CreateObject("MailBee.SMTP")

' Enable logging SMTP session into a file
objSMTP.EnableLogging = True
objSMTP.LogFilePath = "C:\Temp\smtp_log.txt"
objSMTP.ClearLog

objSMTP.LicenseKey = "put your license key here"

' Set SMTP server name
objSMTP.ServerName = "mail.server.com"

' Enable SMTP authentication
objSMTP.AuthMethod = 2

' Set authentication credentials
objSMTP.UserName = "jdoe"
objSMTP.Password = "secret"

' Set message properties
objSMTP.FromAddr = "sender@firstdomain.com"
objSMTP.ToAddr = "recipient@seconddomain.com"
objSMTP.Subject = "Test"
objSMTP.BodyText = "Body of the test message"

' Try to send message
If objSMTP.Send Then
  Response.Write "Sent successfully"
Else
  Response.Write "Error #" & objSMTP.ErrCode & ", " & objSMTP.ErrDesc
End If
%>
See Also:
ErrCode Property

 


Send feedback to AfterLogic
Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.