HomeGenie Forum

Automation Program Plugins and Wizard Scripting => Help => Topic started by: maccosx on September 08, 2015, 08:19:14 AM

Title: Imap/Pop Client to fetc mail in HG and import third party class library c#
Post by: maccosx on September 08, 2015, 08:19:14 AM
Hi,

i configured the eMail account to send mail (i had problems with Gmail account so i switch to another free email service but that's another issue). I 'm now able to send email but i don't understand if there is already the possibility to fetch email with POP or IMAP directlu from within HG.

Looking at NetHelper.cs source corde i see there is a sort of IMAP client helper declared but then its not used anymore anywhere.

Code: [Select]
#region IMAP client

        /// <summary>
        /// IMAP mail client helper.
        /// </summary>
        /// <returns>The IMAP client.</returns>
        /// <param name="host">Host.</param>
        /// <param name="port">Port.</param>
        /// <param name="useSsl">If set to <c>true</c> use ssl.</param>
        public ImapClient ImapClient(string host, int port, bool useSsl)
        {
            return new ImapClient(host, port, useSsl);
        }

        #endregion

So, the question is, can i retrieve mail with HG using POP3 or IMAP ?
If not, is it possible to import third party classes to start using already developed pop/imap client for c#?

Thanks
Cristiano
Title: Re: Imap/Pop Client to fetc mail in HG and import third party class library c#
Post by: Gene on September 08, 2015, 11:12:01 AM
It's not currently possible to import libraries in a CSharp program. It is possible by using Python or Ruby though:

http://stackoverflow.com/questions/18427775/how-to-load-dll-using-iron-python (http://stackoverflow.com/questions/18427775/how-to-load-dll-using-iron-python)
http://www.ironshay.com/post/Starting-Using-IronRuby-in-25-Minutes.aspx (http://www.ironshay.com/post/Starting-Using-IronRuby-in-25-Minutes.aspx)

The imap client used in the NetHelper has never been tested.
This is the underlying class used by it:

https://github.com/genielabs/HomeGenie/blob/master/MigFiles/SupportLibraries/NetClientLib/ImapClient.cs#L72 (https://github.com/genielabs/HomeGenie/blob/master/MigFiles/SupportLibraries/NetClientLib/ImapClient.cs#L72)

In the future I was thinking to allow importing other libraries in a csharp program. A good candidate for mail functionalities could be:

https://github.com/jstedfast/MailKit (https://github.com/jstedfast/MailKit)

g.
Title: Re: Imap/Pop Client to fetc mail in HG and import third party class library c#
Post by: maccosx on September 08, 2015, 01:52:12 PM
Thanks for the infos Gene,

i'm trying to test imapclient and i found that you misspelled "Authenticate" method in

https://github.com/genielabs/HomeGenie/blob/master/SupportLibraries/NetClientLib/ImapClient.cs (https://github.com/genielabs/HomeGenie/blob/master/SupportLibraries/NetClientLib/ImapClient.cs)

you wrote "Authenicate"...

I will continue with the test now