Email Interface Development

Coordinator
Dec 2, 2009 at 3:53 PM

Here we can discuss the development of this feature and the API to enable it.

Developer
Dec 2, 2009 at 9:12 PM

I will upload the service project till the business layer is ready for creating tickets und adding repliesetc...
Or, i can add this project next monday here on svn ;)

MoPhat

Developer
Dec 2, 2009 at 10:46 PM
Edited Dec 3, 2009 at 6:39 AM

Ok, me again ;)

... so each sub group should have (has) a email adress, with information about the email server, password etc... i can check with the email parser service for new mails/tickets.

let me explain this with a example:

group> IT
sub group> software dev.   > software.it@contoso.com
sub group> help desk         > helpdesk.it@contoso.com

the user can send a mail to one of the email boxes, the mail parser service picks the mails and generates new tickets in the right sub groups...
if the mail subject contains  [Ticket#2929].. it generates a reply to ticket.

is this clear?

and if no mail detail is given, no mails are picked ;)

MoPhat

Developer
Dec 7, 2009 at 2:28 PM

I have now added the EmailParser project to the solution, the DomainModel is not yet implemented in the service > my next to do ;)
I'm using this component  http://sourceforge.net/projects/hpop/  for the POP3 stuff.

thx
MoPhat

Coordinator
Dec 8, 2009 at 4:10 AM

Awesome, let me know if I can do anything - I will be gone this weekend for 4 or so days as I move back to the US :)

Developer
Dec 8, 2009 at 6:22 AM
Edited Dec 8, 2009 at 6:23 AM

Shure, of course you can help ;)

- To check if a ticket exists >>>>   DomainModel.Ticket.Get(tid);          <<<< is this correct?
- How do i'm get the attachment path for a ticket?
- How do i'm get the list with the email adresses, password, pop3server and the port?
- How do i'm add a reply to a existing ticket?
- How can i access the settings.xml over the DomainModel, i need there a pop3Intervall (int32) entry


Is this right for creating a new ticket?

string path = @"C:\MyAttachments\32\"
DomainModel.
Ticket.Email.New(m.FromEmail, m.Subject, body, GetFiles(path), path);

private static IEnumerable<FileStream> GetFiles(string directoryName)
{
 
string[] fileNames = Directory.GetFiles(directoryName, "*.*", SearchOption.TopDirectoryOnly);foreach (string name in fileNames)
    {
       yield return File.OpenRead(name);
    }

}

Yeha, back to usa!

 

Thx
MoPhat

 

 

Coordinator
Dec 8, 2009 at 4:07 PM

Shure, of course you can help ;)

- To check if a ticket exists >>>>   DomainModel.Ticket.Get(tid);          <<<< is this correct?

 

 

 

  • Yes it was, but it changed a little bit, now it's at DomainModel.Objects.Tickets.Get(tid);
  • I would recommend just putting a using DomainModel.Objects; at the top to save some space :)

- How do i'm get the attachment path for a ticket?

  • It is at WebUI.Settings.AttachmentDirectory + ticket.id BUT... keep in mind that the attachment functions take care of building the directory so you dont have to worry about adding the ticket.id in a lot of cases


- How do i'm get the list with the email adresses, password, pop3server and the port?

  • by using Units.SubUnits.Get(subUnitId).Mailboxes; - that will get you a list of Mailbox items for that sub_unit which have all that info in them
  • a sub_unit can have any number of Mailbox items (or zero)


- How do i'm add a reply to a existing ticket?

  • If you are using this for the email portion, use Comments.Email.New()


- How can i access the settings.xml over the DomainModel, i need there a pop3Intervall (int32) entry

  • You can't, I made DomainModel so it is not dependant on any outside projects, you will have to write your own accessor for that or use the one in WebUI somehow


Is this right for creating a new ticket?

  • Close, the only this that is wrong is you should only have @"C:\MyAttachments\" as the path, the function will add the id on there



string path = @"C:\MyAttachments\32\"// <- this should be @"C:\MyAttachments\"
DomainModel.

Ticket.Email.New(m.FromEmail, m.Subject, body, GetFiles(path), path);

private static IEnumerable<FileStream> GetFiles(string directoryName)
{
 
string[] fileNames = Directory.GetFiles(directoryName, "*.*", SearchOption.TopDirectoryOnly);foreach (string name in fileNames)
    {
       yield return File.OpenRead(name);
    }

}

I moved some stuff again, but this hsoul dbe the last time as I have the DomainModel logic completely removed from the WebUI any references you had in your project that I broke I went in and fixed so it builds.

Thanks again, this is going to be great when it is all implemented!

Coordinator
Dec 8, 2009 at 4:12 PM

just for clarification:

DomainModel.Objects.Tickets.Get(tid);

will return a null ticket if it does not exist

Developer
Jan 6, 2010 at 12:43 PM

Hi, back in usa?

I have uploaded the sources for the service and i have a few questions
please check the class SlickTicket.EmailParser\Classes\BusinessLogic.cs at lines 47, 88 and 93 and point me in the right direction ;)

thank you
MoPhat

Coordinator
Jan 10, 2010 at 5:08 PM

MoPhat, you are kickin butt, thanks a lot for all the hard work.

Sorry I have not been helpful at all lately, but I am all moved back in and ready to get back to business (took a 3 week sabbatical :))

Are you still having these problems? If so, I will check into it ASAP - once again, thanks for all the help, me and all the users are very grateful!

Developer
Jan 11, 2010 at 8:21 AM

Yes, please check the class SlickTicket.EmailParser\Classes\BusinessLogic.cs at lines 47, 88 and 93 and give me a info how to use that correct.

Coordinator
Jan 15, 2010 at 3:52 PM

Sorry once again for taking so long... Grad school just started and I got sidetracked - here you are:

 

Line 47:

Units.SubUnits.Get(0).Mailboxes gets the sub-unit of id '0', and then gets it's mailboxes.  What you want to do is specify which sub-unit in place of '0' to get the mailbox for.

 

Line 88:

I store this in the settings.xml file in the WebUI (did not want to make the DomainModel dependant on anything else) so you can get this by using WebUI.Settings.AttachmentDirectory

 

Line 97:

Yes, that is correct.  You can also combine it into one line if you are not going to reuse the DataContext (it's up to you, doesn't really matter):

Tickets.New(new stDataContext(), m.Subject, body, 0, 0, u, GetFiles(pathToAttachments), pathToAttachments);

Developer
Jan 19, 2010 at 1:05 PM

Thank you stan

Ist there a way to get all mailboxes without providing a id > Units.SubUnits.Get().Mailboxes ?

For a now growing system with a email service and maybee later more apps around this, its not better to palce the settings on the sql server in a config table instead a xml file?
Then we can access the settings by a small method, the apps needs then only the connection string...

thx
MoPhat

Coordinator
Jan 27, 2010 at 2:32 AM

If you want to get all the mailboxes you can simply do something like this:

stDataContext db = new stDataContext();

var allMailboxes = db.Mailboxes; 

Or, if you specifically tell me what you want, I will just add one to the DomainModel (that is the most proper way)

 

I would be open to saving all the info in a DB table... do you think it should be hashed for security?

The reason I kept everything in the XML is that it is much faster than a SQL trip -- I would only keep the universal settings in the DB as it will be slower than an XML lookup.

What do you think?

(again, sorry for the latent replies, I am in Graduate School right now and it is very time consuming)

Developer
Jan 27, 2010 at 6:13 AM
Edited Jan 27, 2010 at 6:28 AM

Hi Stan, i think you can use a application session with a check if its full or emtpy.
with this you could reduce the sql round trips.

i will check with the mailbox access later, a lot of work here ;)

p.s.
for security reasons, it should be just the password from the pop3 account hashed

greetings from switzerland
MoPhat

Mar 7, 2010 at 12:36 AM

where can us end users get this email interface to play with?  my users are already accustomed to sending emails to get help.

Coordinator
Mar 19, 2010 at 3:49 AM

It is available in the source code, mophat should be able to help you with it.

I have been very behind in working on S-T because of graduate school, I apologize.

Sep 5, 2014 at 4:17 PM
Has there been any further development on this subject? I'd like to try to implement something like this here.
Coordinator
Sep 8, 2014 at 3:03 PM
I am not developing any further on ST, I have not heard of anything lately, though if you want to run with it I will gladly add you to the project!
Sep 18, 2014 at 2:13 PM
Yeah, that would work. I'll look at the code and see if it's something that I can take on.