How do I compose an email for Office365 using Delphi? - delphi

I need information on how to allow an end user to compose an email, in Delphi code. Our Delphi version is Delphi Seattle (I think that is 10.1?) We use office365 as our email program. I need to pre-fill the recipient and some html in the body of the email. The end-user needs to complete the body of the email then click the send button.
We used to use the reliable "mailto" commandline that then displayed an email form. But it only works with plain text, no html. I now need to have html in the body of the email. I switched to using the ancient semi-reliable TOutlookApplication component and using it in code to do this thru OLE. I do see a dialog pop up, and the html appears to render correctly, but the send button seems to do nothing. Looking at the code used by TOutlookApplication, it appears that it's not been updated since the glory days of XP.
I am using Delphi Seattle. I don't think I can use Indy components with stmp because the email dialog has to be present to allow for the composing of the email, and I didn't see a way for Indy to display the form. Can anybody please tell me what I gotta do to make this work? If anybody wants to see my current code using TOutlookApplication, I can post it, but it's like 1,000 other Delphi examples of the component. Surely, others have overcome this, right?
I have additional information on this. I was running my application on a virtual machine, but my outlook was running in the desktop. Once I run the application on the desktop, it ran fine. I even received the test emails I hadn't from the vm. I believed the vm was aware of the desktop applications. My bad!

The problems I experienced were due to running on a virtual machine. If there are other dolts trying to run an app that uses OLE to access Outlook from a VM, make sure you have a Outlook ON THE VM. Or run your app from the someplace that has Outlook installed, like a desktop.

Related

Unable to access SQL table from appl running as service

I have a small test application, made with Delphi 10.3.1 as an Stand Alone HTTPSYS Intraweb service. It has an ADOConnection and a ADOTable and in FormShow of unit1, I open the connection, and the table and reads the first 10 rows and add them to a listbox. Just to see that it works and is possible.
When running the application as a Stand Alone HTTPSYS, vith visual GUI, it's working nicely, but when I compile it as a service, and install it, on the sql server, or on the development machine, it fails with access Violation, trying to open the table. I suppose it is an Authentication problem.
I have tried to open connection with both Windows Auth, and with a specific SQL login, and I have tried running the service with both local system (default) and with the specific SQL account.
What am I missing ?
The Specific SQL login, works in SSMS. I'm able to use it to login and access my tables.
Also, if I create the application as a DLL and put it on my IIS10, it works fine.
You are right. It has nothing to do with authentication.
For the IntraWeb HttpSys Stand Alone program to run as a service, the ServerController.ComInitialization property must be set to ciMultiThreaded.
Thanks for your comment which lead me to look elsewhere. You do deserve the credit.
Regards
Soren

Intraweb - web application - users sessions

Today I started to write my first web application and I can't pass one step.
Everything works almost fine... I can connect to the server and open website. Problem is when I open browser and type the same address on the second pc, then I get te same data as on the first one.
Detailed...
Application has two forms, first is for login, and second one is for receiving data.
When I login on the first pc and second form shows up, and then I open browser and put the address of the server on the second pc, I see the second form after login from first pc.
What I should do in this case? I tried to find the solution in the net, but I couldn't :(
If you are using any Delphi IDE after XE3 (including) and using the IntraWeb edition that comes with Delphi you must upgrade in order to have it working correctly. It is free, and more information can be obtained here:
http://atozed.com/IntraWeb/Download/FreeKeyRequest.EN.aspx|
After upgrading (if this is your case) I suggest you to take a look at one of the IntraWeb demos, here:
https://iwdemos.codeplex.com/SourceControl/latest
There is a demo named Features that shows you exactly how to create a multi form application. To be honest, I work with IntraWeb for a long time and I've never seen that. Unless you are using some global var to hold your "current" active form. Have in mind that IntraWeb is a fully multithreaded application and global vars should not be used, unless you have some mechanism protecting concurrent access (but you should get rid of them and use ServerController properties instead).
Thnks for your quick reply.
I work with Delphi from some time, but I never used Intraweb, I worked with ComPort and IP works for I/O devices. I have XE7 and I upgraded Intraweb to 14.0.52.
I can't find a good file exchange server to put my application for sharing with you. If I find somethin I will post it below.
You can check the code and other settings of my simply project. I put the web application inside the link below, it is without the .exe file.
https://www.dropbox.com/s/75zurcew0zr363x/Project1.rar?dl=0
Thanks for your help.

How to solve exception error when consuming Microsoft Sql Server Reporting Services (SSRS) 2005 from Delphi XE7

I am trying to create a sample Delphi XE7 desktop app that will connect to SSRS 2005 web service but every time I try to call LoadReport web method, the following error is shown:
This is what I have done so far:
Create a desktop app.
Import WSDL for ReportExecution2005 and ReportService2005.
Create a button that call the web service based on the code shown
here. The web service locations as well as report are hardcoded for
simplicity purposes.
This is the code snippet from the link:
HTExec := tHttpRio.Create(nil);
rsExec := GetReportExecutionServiceSoap(False, ExecURL, HTExec);
// Load the selected report.
LRParams.Report := 'ReportName';
LoadParamsResponse := rsExec.LoadReport(LRParams); //here it fails
Note: I have already created a .NET win form app (VS2010 and VS2013) that consumes this web service without any issues, thus I know the web service and report to render are working OK. Sadly our requirements is for a Delphi solution, My educated guess is that the WSDL importer generated code is not correct and somebody out there may have come across with this issue before and know how to solve it.
I did a quick search for "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/LoadReport"
and found this.
If it applies to you as well, it may be the case you're calling the service on an incorrect URL, use the one with ReportExecution2005.asmxin it, not ReportService2005.asmx
(There's a lot more here)
To find out differences between the Delphi version and the working version, use a HTTP proxy (Fiddler2) to capture the SOAP HTTP traffic in both setups.
If you have no access to the working environment, use SoapUI to create SOAP requests.

What are the issues with regards to printing non-standard fonts in RDLC reports?

We use the Microsoft Report Viewer control in our web application to print checks. The report needs to use a special MICR bank font in the report. Something like this: http://www.micrfonts.com/
Anyways the font is just a regular TTF font installed in Windows.
Now, when testing the printing on my local setup, everything works perfectly. The checks print on my personal LaserJet using the font correctly.
However, at my client's site, he is telling me that the font is rendering in the web-browser OK, which I think confirms that he has the proper font installed on his machine, but when he sends the report to the printer, the printout does not use the correct font.
Are there any limitations with the RDLC printing with regards to non-standard fonts? I'm not sure how to troubleshoot this issue.
Any help would be appreciated.
More details that I just discovered:
Apparently, everything works from my PC if I connect to my local instance of the app on localhost.
However, if I connect to my app on our remote dev environment, I can replicate the issue of the font not properly printing.
Figured it out. Apparently the font needs to be installed both on the client, and on the webserver.
When rendering to screen, the report viewer uses Html, so the font needs to be on the client machine. However, when printing, the report is generated server side before being sent to the printer, so in that case, the font needs to exist on the server, otherwise it will be substituted.
Took a while to find this. Hope this helps someone else.

Delphi Printer.Printers not refreshing

I have created a Delphi service which is responsible for printing QuckReports to specific printers contained within the printer.Printers list. I pass my routine the printer name and it looks up in the printer.printers array to get the proper index. It then does this:
QuickRep1.PrinterSettings.PrinterIndex := iIndex;
In the help files it says this for printer.refresh: "Call Refresh when the installed fonts or printers on the current system may have changed". So I call the refresh before I look up the printer name against the printer.printers array.
At one of my installations this function is not working properly. If printers are added/deleted, or someone with printers under their profiles logs on, the list does not seem to get refreshed until the service is stopped and restarted.
Does this function not work for services?
The installation where this is occurring utilizes "virtual services". Could this have anything to do with it?
Thanks.
My experience and understanding is the printers array is updated only at application start. Anytime a new printer is installed, the application must be restarted to get the correct list.
I'm curious to hear any different experience with this myself.
EDIT: From my comment below; I wrote a small test program that confirms the TPrinters.Refresh() does update the printers list.

Resources