Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: Attachments.Add possible bug Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
pevrard
Newbie
Newbie


Joined: 03 November 2008
Location: Belgium
Online Status: Offline
Posts: 9
Posted: 03 November 2008 at 5:56am | IP Logged Quote pevrard

Hi,

I'm trying to attach a file to a MailMessage using Attachment.Add(filename as string) without success. Every time I got the exception:
"Object reference not set to an instance of an object".
The MailMessage object exists as well as the file referred by the filename passed as argument to the method Add.

Is this a bug? The version I'm using is 4.02.105.

Thanks in adavnce for your help
Pierre
Back to Top View pevrard's Profile Search for other posts by pevrard
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 03 November 2008 at 6:10am | IP Logged Quote Andrew

As we mentioned in our reply (we sent you via e-mail), it's necessary to run the application in debug mode to learn the line the exception is thrown at. Without more detailed info, it's not possible to say anything for sure.

Also, please don't duplicate questions sent through Request Support form on this forum. Forum has the same priority.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
pevrard
Newbie
Newbie


Joined: 03 November 2008
Location: Belgium
Online Status: Offline
Posts: 9
Posted: 03 November 2008 at 6:24am | IP Logged Quote pevrard

I did that. The Exception is raised at line mailMsg.Attachments.Add(_fileAttachmentName);

in the following code extract. I upgraded MailBee recently. With an older version it works perfectly.

mailMsg.Subject = _sageMsgSubject;
             // the text bodypart
             mailMsg.BodyPlainText = _dataTextFromMessage.ToString();
             // and the attachment
             if (File.Exists(_fileAttachmentName))
             {
                mailMsg.Attachments.Add(_fileAttachmentName);
             }
Back to Top View pevrard's Profile Search for other posts by pevrard
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 03 November 2008 at 6:34am | IP Logged Quote Andrew

Thank you for additional info.

4.02.105 is not the latest version of MailBee.NET.dll. Please upgrade it to the latest version and try to reproduce the issue.

If the issue still happens, please provide us with full stack trace.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
pevrard
Newbie
Newbie


Joined: 03 November 2008
Location: Belgium
Online Status: Offline
Posts: 9
Posted: 03 November 2008 at 6:59am | IP Logged Quote pevrard

The problem is still present, follows the requested information:

System.NullReferenceException was caught
Message="Object reference not set to an instance of an object."
Source="MailBee.NET"
StackTrace:
       at dv.a(String A_0)
       at MailBee.Mime.AttachmentCollection.Add(String filename, String targetFilename, String contentID, String contentType, HeaderCollection customHeaders, NewAttachmentOptions options, MailTransferEncoding mailEnc)
       at MailBee.Mime.AttachmentCollection.Add(String filename, String targetFilename)
       at MailBee.Mime.AttachmentCollection.Add(String filename)
       at ExchangeSageInterface.SageReader.BuildAndSendMail() in C:\GW-Prjs\ESLC_T\Gateways\ExchangeSageInterface\ExchangeSag eInterface\SageReader.cs:line 1440
       at ExchangeSageInterface.SageReader.HandleMessage() in C:\GW-Prjs\ESLC_T\Gateways\ExchangeSageInterface\ExchangeSag eInterface\SageReader.cs:line 1532

Back to Top View pevrard's Profile Search for other posts by pevrard
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 03 November 2008 at 7:09am | IP Logged Quote Andrew

Thank you for the stack trace.

Does it happen with a certain file only or with any file?

Does it depend on file size or file type (or even content)?

Please try to reproduce the issue with other files and let us know the outcome.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
pevrard
Newbie
Newbie


Joined: 03 November 2008
Location: Belgium
Online Status: Offline
Posts: 9
Posted: 03 November 2008 at 7:13am | IP Logged Quote pevrard



Hi Andrew,

Apparently it happens with any file. I tried with a couple of files of different type (txt, csv), size and content.
I will make some additionnal tests tomorrow.
In any case thanks for your prompt support.

Pierre
Back to Top View pevrard's Profile Search for other posts by pevrard
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 03 November 2008 at 7:20am | IP Logged Quote Andrew

Forwarded this info to the developers. They'll investigate the issue.

Will keep you updated.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 05 November 2008 at 3:20am | IP Logged Quote Andrew

The developers couldn't reproduce the issue. Everything works as expected, no exception is thrown.

Please download this simple application and run it.

It's source code is:
Code:
string attachName = @"5_star_rating.gif";
MailMessage msg = new MailMessage();
msg.From.AsString = "user1@domain.com";
msg.To.AddFromString("user2@domain.com");
msg.Subject = "Hello";
msg.BodyPlainText = "Hello, World!!!";
if (File.Exists(attachName))
{
        msg.Attachments.Add(attachName);
}
msg.SaveMessage(@"temp.eml");


I.e. creates a message, attaches an attachment and saves the message. Try to reproduce the issue via this application. It's important to use the executable from the archive, don't create a new application with this source code.

Please let us know the outcome.

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
pevrard
Newbie
Newbie


Joined: 03 November 2008
Location: Belgium
Online Status: Offline
Posts: 9
Posted: 05 November 2008 at 6:03am | IP Logged Quote pevrard

It works but my program still not works.

regards
Pierre
Back to Top View pevrard's Profile Search for other posts by pevrard
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 05 November 2008 at 6:21am | IP Logged Quote Andrew

We suppose your application still uses old version of MailBee.NET.dll.

Please try to remove the reference to MailBee.NET.dll from your application and explicitly add a new reference to the MailBee.NET.dll you've downloaded along with the sample application. Does it help?

Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
pevrard
Newbie
Newbie


Joined: 03 November 2008
Location: Belgium
Online Status: Offline
Posts: 9
Posted: 06 November 2008 at 12:07am | IP Logged Quote pevrard

Yes it works now.
Thanks a million for your excellent support.

Best regards
Pierre
Back to Top View pevrard's Profile Search for other posts by pevrard
 

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