Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET SMTP

 AfterLogic Forum : MailBee.NET SMTP
Subject Topic: Not in SMTP context after Send() Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Maritim
Newbie
Newbie


Joined: 06 December 2012
Location: Norway
Online Status: Offline
Posts: 1
Posted: 06 December 2012 at 3:14am | IP Logged Quote Maritim

I am using MailBee.NET 4 for sending e-mail via SMTP, but I am experiencing some strange behaviour. I am writing some sophisticated error handling and therefore I have need of the SMTP reply code from the server after an attempt at sending e-mail has been made. However, when I attempt to call the MailBee.SmtpMail.Smtp.GetServerResponseCode() (http://www.afterlogic.com/mailbee-net/docs/MailBee.SmtpMail.Smtp.GetServerResponseCode.html) I receive a MailBeeInvalidStateException since I am apparently no longer in an SMTP context.

Could someone please enlighten me with regard to the reason for why I am no longer in an SMTP context? This makes no sense to me.
Back to Top View Maritim's Profile Search for other posts by Maritim
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 08 December 2012 at 11:46am | IP Logged Quote Alex

There is a number of conditions to be met to stay in SMTP context. Mail of them:
- the connection must be made to a single SMTP relay server. Multi-threaded connections and direct send operations are not SMTP contexts (they are more complex contexts)
- .Connect (and .Hello, .Login) method must be called explicitly. Otherwise, to the moment when .Send method ends, it disconnects automatically. If .Connect was called manually, .Send keeps SMTP connection (and context).

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

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