| Author |  | 
      
        | cmoozilla Newbie
 
  
 
 Joined: 23 November 2011
 Location: Canada
 Online Status: Offline
 Posts: 9
 | 
          Hi,
           | Posted: 11 October 2013 at 4:38am | IP Logged |   |  
           | 
 |  
 We have been using Mailbee.NET for some time and for the most part it is working great.
 
 We are accessing the .net component through CLR from within Dynamics AX.
 
 We have been using the quicksend method to send most emails, however some external email servers are blacking our emails and flagging them as spam.
 
 We are now attempting to send emails using one of our customers email servers. The customer has provided us with the server name, id, password, ports, etc...
 
 So here is the issue:
 
 When accessing the smtp .net object using CLR, I cannot determine how to add the smtp server collection to the smtp object.
 
 Here is a sample of the code:
 
 MailBee.SmtpMail.Smtp                   mailer;
 MailBee.Mime.EmailAddress               fromAddress;
 MailBee.Mime.EmailAddress               toAddress;
 MailBee.Mime.EmailAddressCollection     toCollection;
 MailBee.SmtpMail.SmtpServer             mailServer;
 MailBee.SmtpMail.SmtpServerCollection   mailServerCollection;
 ;
 Mailer = new MailBee.SmtpMail.Smtp();
 
 fromAddress = new MailBee.Mime.EmailAddress('chris.moore@trackernetworks.com','Chris Moore');
 mailer.set_From(fromAddress);
 
 toAddress = new MailBee.Mime.EmailAddress('chris.moore@trackernetworks.com','Chris Moore');
 toCollection = new MailBee.Mime.EmailAddressCollection();
 toCollection.Add(toAddress);
 mailer.set_To(toCollection);
 
 mailServer = new MailBee.SmtpMail.SmtpServer();
 mailserver.set_AccountName('test');
 mailserver.set_AccountDomain('test');
 mailserver.set_Password('password');
 
 mailServerCollection = new MailBee.SmtpMail.SmtpServerCollection();
 mailServerCollection.Add(mailServer);
 
 
 At this point I think I should be able to tell the mailer to use the server collection I have created, but I can't seem to find the method to do this.
 
 Below is a screen shot of the methods I have available within AX, no add_smtpServer method... There is get_smtpServers method which returns the current server collection.
 
 http://www.pricetrackerdata.com/mailbee_clr.jpg
 
 Any ideas would be greatly appreciated.
 
 Thanks
 
 Chris
 
 
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Smtp object has SmtpServers property which has SmtpServerCollection type. Just use mailer.SmtpServers.Add(mailServer) to populate the collection.
           | Posted: 11 October 2013 at 5:06am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | cmoozilla Newbie
 
  
 
 Joined: 23 November 2011
 Location: Canada
 Online Status: Offline
 Posts: 9
 | 
          Hi Alex,
           | Posted: 11 October 2013 at 5:51am | IP Logged |   |  
           | 
 |  
 For some reason my MailBee.SmtpMail.Smtp object does not have the SmtpServers property...
 
 http://www.pricetrackerdata.com/mailbee_clr.jpg
 
 I'm accessing the .NET component through CLR, which wraps the calls.
 
 Can you help?
 
 Chris
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          It's probably called something else; unlike other properties, this one represents a collection. Please check the entire list of properties carefully, it should be there somewhere.
           | Posted: 11 October 2013 at 5:57am | IP Logged |   |  
           | 
 |  
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | cmoozilla Newbie
 
  
 
 Joined: 23 November 2011
 Location: Canada
 Online Status: Offline
 Posts: 9
 | 
          Hi Alex,
           | Posted: 11 October 2013 at 6:59am | IP Logged |   |  
           | 
 |  
 here is a pic of the complete list I am seeing...
 
 http://www.pricetrackerdata.com/mailbee_clr_complete_list.jpg
 
 Can you tell me which one to use?
 
 Chris
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          As far as I can see, it is there:
           | Posted: 11 October 2013 at 7:20am | IP Logged |   |  
           | 
 |  
 
   
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | cmoozilla Newbie
 
  
 
 Joined: 23 November 2011
 Location: Canada
 Online Status: Offline
 Posts: 9
 | 
          Hi,
           | Posted: 11 October 2013 at 7:34am | IP Logged |   |  
           | 
 |  
 Yes I see that, that would get the current SMTP server collection, I am trying to set the server collection, there is no corresponding function to set the smtp server collection.
 
 Chris
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          That's the only property of such kind and it is read-only, you can't set it directly. The collection has Add method you need to use for adding items to it.
           | Posted: 11 October 2013 at 7:39am | IP Logged |   |  
           | 
 |  
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | cmoozilla Newbie
 
  
 
 Joined: 23 November 2011
 Location: Canada
 Online Status: Offline
 Posts: 9
 | 
          Hi Igor,
           | Posted: 11 October 2013 at 9:59am | IP Logged |   |  
           | 
 |  
 Yes that is what I am trying to do... Add a smtp Server.
 
 I don't see how it can be done... Is there any chance we can share screens and I can show you what I am experiencing?
 
 Chris
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          In C#, it's something like
           | Posted: 11 October 2013 at 10:10am | IP Logged |   |  
           | 
 |  
 
| Code: 
 
    
    | 
      
       | mailer.SmtpServers.Add(server) |  |  |  or
 
 
| Code: 
 
    
    | 
      
       | mailer.SmtpServers.Add("servername", "user", "passw") |  |  |  I guess in your language it would be somewhat like
 
 
| Code: 
 
    
    | 
      
       | mailer.get_SmtpServers().Add(server) |  |  |  or
 
 
| Code: 
 
    
    | 
      
       | mailer.get_SmtpServers().Add("servername", "user", "passw") |  |  |  I don't see any rocket science here. Am I missing something?
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | cmoozilla Newbie
 
  
 
 Joined: 23 November 2011
 Location: Canada
 Online Status: Offline
 Posts: 9
 | 
          I agree, it's not rocket science!
           | Posted: 11 October 2013 at 10:25am | IP Logged |   |  
           | 
 |  
 From my environment there is no .Add(server) function available.
 
 From the list of functions available:
 
 http://www.pricetrackerdata.com/mailbee_clr_complete_list.jpg
 
 You think there would be a "set_serverCollection()" function to set the servers, but it is not listed anywhere.
 
 the get_smtpServer just returns a serverCollection, does not allow you to add a server.
 
 Please let me know what else I can look at, i'm stumped!
 
 Chris
 
 
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Igor AfterLogic Support
 
  
 
 Joined: 24 June 2008
 Location: United States
 Online Status: Offline
 Posts: 6168
 | 
          
           | Posted: 14 October 2013 at 1:36am | IP Logged |   |  
           | 
 |  
| Quote: 
 
    
    | 
      
       | You think there would be a "set_serverCollection()" function to set the servers |  |  |  
 No, it's not going to work that way with read-only collections. The only option there is to use Add method for it.
 
 --
 Regards,
 Igor, AfterLogic Support
 | 
       
        | Back to Top |     | 
       
       
        |  |