I managed to use the API to post a new ticket from an Outlook message.

Do you ever felt frustrated because a staff member receives a direct mail containing a support request instead of using the company sanctioned support e-mail?

Now you can have a "Forward to osTicket" button in your Outlook using this macro. The ticket gets created keeping the original sender.

Please take a look. I know very little about Outlook programming so it's very rough. I expect to add attachments soon. It may be useful as an API sample.

[osTicketConnector.txt](https://forum.osticket.com/assets/files/migrated/8/913e9547b8ab0a3547879a6d104419a.txt)

This is really neat. Quick comment - why not post the complete raw email text - headers + attachment included. osTicket's API can handle the parsing without you worrying about encoding related issues - simply post to /api/tickets.email

So I decided to play with getting this to work this morning for a few minutes and couldn't get it to work. I opened Outlook 2010, added the developer tab, changed the macro settings, created a new macro and pasted your code into it, customized the API_KEY and HOST NAME and saved it. I then double checked the API string in ost. Closed Outlook, re-opened Outlook, Opened an email, and ran the macro..... and nothing.

I checked my php error log and am not seeing any errors.

I'm not seeing anything in my IIS logs either.

Did I miss something obvious?

additional notes:

This is a freshly installed version of Outlook 2010.

Windows Server 2008 SP2, IIS 7 running PHP 5.3.13 and osTicket v1.7ST.

We are using Active Directory and my computer and server are members of the domain.

4 days later

peter, you're absolutly right.

It should be something like

http.send myMsg.GetRawMessage

The GetRawMessage() should be the obvious API method for any decent mail application.

I'm yet to find it inside Outlook.

ntozier,

Please check the following:

1. The osTicket API requires a special server configuration. This way the server will serve the /api/http.php/tickets.xml request, wich normally should give a 404 response. The /api/.htaccess file contains the Apache rules for this to work. This will be ignored inside an IIS configuration. Please check http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/translate-htaccess-content-to-iis-webconfig(http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/translate-htaccess-content-to-iis-webconfig).

2. Any compiler error in my script. You should add a reference to Microsoft XML v6.0.

3. Any problem to establish a port 80 connection to the osTicket host from Outlook. This smells like a worm, so check for firewall or AV activity, or any proxy definition that's on the way.

4. The first version didn't work if the sender was from within an Exchange environment. This should trigger an osTicket exception, though, and still see activity in your IIS.

5. The Outlook 2010 Macro activation may be unclear, I don't know much more either. Macros would still be disabled even if you checked them on. Open the VBA editor and just press the "Run" button. If macros are disabled, you should see an error box.

peter, you're absolutly right.

It should be something like

http.send myMsg.GetRawMessage

The GetRawMessage() should be the obvious API method for any decent mail application.

I'm yet to find it inside Outlook.

Let us know if you figure it out - working on the same thing for Gmail/Google Apps.

I am using Apache (not iis) and I am seeing much the same thing as mentioned above.

- no errors to speak of

- just no ticket sent over

I wanted to add what a great mod/ concept!

24 days later

I'm not sure what I'm doing wrong, and can't get it to work.

but this are the steps I did. (Outlook 2013)

1. Create API in OSticket with Mail Server (exchange) Outgoing IP.

2. Modify the top lines of script

'Change these to suit your environment

Const API_KEY = "Copy of API here"

Const HOST_NAME = "https://help.intentinallygone.com"

Const MAX_ATTACHMENT = 2097152

3. Go to Outlook 2013

4. press ALT+F11

5. Double Click 'ThisOutlookSession' and paste the code

6. Save

7. Make sure that Macros can run in the Trust Center

8. Add the button to the Ribbon at the top

Now when I click an email nothing happens...

@[deleted],

I never got it working either.

10 days later
2 months later

Additional information

Cudos to estrelow for doing the heavy work in this mod, but I had some issues with getting this working so I wanted to give some clarifications on how to get it up and going.

I'm using Windows 2008R2 / php / mySQL

In IIS you must add the URL Rewrite: I followed (http://www.iis.net/learn/extensions/url-rewrite-module/importing-apache-modrewrite-rules) instructions.

Restart the webserver

Add a API Key from the osTicket Admin Panel website "Manage - Add API Keys"

In Outlook open VB for Applications (ALT+F11)

In a project - insert a new module and specify the (Name) osTicketConnector

Then paste the modified code estrelow provided, and update Const API_KEY and HOST_NAME

REMOVE the topline "Attribute VB_Name = "osTicketConnector" from the script

Click on "Tools - References" and check "Microsoft XML, v6.0"

Save and close VB

Either in your inbox or in an open email right click to customize the ribbon bar, select Macros from Choose commands and select Project.Post2osTicket and add it to a custom group

That worked for me!

Thanks...This works great now.

I'll see if I can turn it into a batch script to set it up. Do you know how to setup the API without having an IP restriction?

Hi, I'm using Outlook 2007 so with Module in first post I cant get email address from Exchange user. is there any alternative solution?

Api Key IP address

I was able to get this working based on hanspnilsson instructions. Can an API key be generated for a range of addresses or for any address?

5 days later

Choosing Department

Is there away that the department that the ticket gets routed to can be changed? Maybe this can be something that is input by the support engineer? How is this handled currently?

Attachment issue

I am able to use this as it sits, until i try to add an attachment. it says:

Run time error '-21470254891 (80070005)':

Cannot save the attachment. You don't have appropriate permission to perform this operation.

if I then choose the debug it got to:

'I only add attachments up to a limit in size

If oFile.Size

sTmpFile = fs.GetTempName

oFile.SaveAsFile sTmpFile

and highlights:

oFile.SaveAsFile sTmpFile

Windows 2008 server IIS box

Correction- it only worked once

I tried other emails and they all failed to be added. No errors. Just nothing happened after the first successful submission.

I am still unable to get this to work.

Using hanspnilsson's instructions on a Windows 2008 server with Apache 2.2 & Outlook 2007, nothing happens. No errors, no tickets, nothing.

I got this to work on two machines, but the big problem is that there isn't a way to have the IP restriction disabled.

It makes it useless for us if we are out of the office and want to send tickets in.

The next step would be to just blank forward an email to the helpdesk. Maybe do a seperate email account with filter.