Search The ForumSearch   RegisterRegister  LoginLogin

MailBee Objects

 AfterLogic Forum : MailBee Objects
Subject Topic: SMTP In mailbee objects Problem Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
alexandre
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 22 September 2005 at 11:01am | IP Logged Quote alexandre

Hi,

I trying to use the MailBee.Objects, the pop3 component is functioning right, but i could not send a message, with smtp component, and there is no error messages, just it's not sending my message

My Code:

     Dim objSMTP
     Dim Rs, SQL
     
     SET objSMTP = Server.CreateObject("MailBee.SMTP")
     set Rs = server.CreateObject("ADODB.Recordset")
     Dim dochtml
     Dim from
     Dim para
     Dim cc
     Dim assunto
     Dim smtpserver, smtpaut
     Dim smtpuser
     
     assunto = request("assunto")
     dochtml = request("dochtml")
     from = request("from")
     para = request("to")
     
     
     SQL = "SELECT smtpport, smtpserver, smtpuser, smtpaut FROM tb_emailconta WHERE email = '" & from & "'"
     Rs.Open SQL, SESSION("CON")
     
     smtpport = rs("smtpport")
     smtpserver = rs("smtpserver")
     smtpaut = rs("smtpaut")
     smtpuser = rs("smtpuser")
     
     
     if ISNULL(smtpport) then
           smtpport = 25
     end if
     
     Response.Write FROM
     Response.Write para
     Response.Write dochtml
     Response.Write smtpport & smtpserver & smtpuser
     'Response.End
     
     objSMTP.Message.BodyFormat = 1

     objSMTP.LicenseKey = license
     if smpaut = true then
           objSMTP.AuthMethod = 2

           objSMTP.ServerName = smtpserver
           objSMTP.UserName = smtpuser
           objSMTP.Password = session("passEmail")
           objSMTP.PortNumber = smtpport
     end if
     
     cc = request("cc")
     
     assunto = request("assunto")
     
     
     objSMTP.Connect
     
     objSMTP.Subject = assunto
     objSMTP.FromAddr = from
     objSMTP.ToAddr = para
     objSMTP.CCAddr = cc
     objSMTP.BodyText = dochtml
     
     objSMTP.Send
     objSMTP.Disconnect


Waiting your response


Tanks
Back to Top View alexandre's Profile Search for other posts by alexandre
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 22 September 2005 at 11:32am | IP Logged Quote Alex

When error occurs, MailBee sets IsError, ErrCode, ErrDesc property values rather than throwing an exception.

Also, you can test return value of Connect or Send methods.

Code:

If objSMTP.Connect Then
  ...
Else
  Response.Write "Error #" & objSMTP.ErrCode
End If


You can find more detailed error handling samples in ASP SMTP demos shipped with MailBee. By default, they are installed in "c:\Program Files\MailBee\Samples\ASP" folder.

Also, you can enable logging MailBee session into a file before connecting to SMTP server:

Code:

objSMTP.EnableLogging = True
objSMTP.LogFilePath = "C:\log.txt"
objSMTP.Connect
...


However, please make sure ASP user has permissions to write into the log file under the path you specified.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
alexandre
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 22 September 2005 at 3:25pm | IP Logged Quote alexandre

Hi Alex,

Tanks for the response...

I Added the lines:
     If objSMTP.Connect Then
     
     Else
           Response.Write "Error #" & objSMTP.ErrCode
           Response.End
     End If


And

     if objSMTP.Send then
     
     else
           Response.Write "Error #" & objSMTP.ErrCode
           Response.End
     end if


And, the error never occurs, and the message is not sended to my email???
What's going on??

Tanks
Back to Top View alexandre's Profile Search for other posts by alexandre
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 23 September 2005 at 7:41am | IP Logged Quote Alex

What is in MailBee log file?

If log file tells sending was ok, it might mean SMTP server itself cannot deliver the message. If this is a case, you should make sure SMTP server is configured properly.

Also, you may try to send from/to the same email addresses and the same SMTP server using Outlook. Does it work?

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Alexandre
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 23 September 2005 at 8:46am | IP Logged Quote Alexandre

Hi,

I see the log file, and is blank

The folder of log file, have permissions to read and write

I use the outlook, and it's work well

My smtp server, requires autentication...
To use the autentication, is the property objSMTP.AuthMethod = 2, right???

The same configuration that i use in outlook, is the same of MaillBee.Smtp. I not get the code work ...

Back to Top View Alexandre's Profile Search for other posts by Alexandre
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 23 September 2005 at 9:03am | IP Logged Quote Alex

If log is blank and logging is enabled (.EnableLogging=True, .LogFilepath is set), this probably means .Connect even does not get a chance to execute.

Try this:

If objSMTP.Connect Then
Response.Write "Connected successfully"
...

and this:

if objSMTP.Send then
Response.Write "Sent successfully"

If you do not see these messages (and "Else" part of IF stataments (which produces "Error #" & objSMTP.ErrCode message) also does not execute, this means your code stops execution somewhere above the code where you try to send message. Maybe there is Response.End or something like that.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
alexandre
Guest Group
Guest Group


Joined: 10 November 2003
Online Status: Online
Posts: 262
Posted: 28 September 2005 at 2:14pm | IP Logged Quote alexandre

Hi,

I solve the problem...

In the code, the licensekey was blank...
And at the beginning of the code, i place a On Error Resume next... Because this, no errors are ocurred in the page

Anyway, tanks for helping...
Back to Top View alexandre's Profile Search for other posts by alexandre
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide