Dear Unigueers,
There are many possibilities to send email with Delphi.
The easiest way a found, is via gmail Server.
Although I found a few portions of code on the forum, no one has detailed the important steps to make it work.
So, here is a sample where you will for sure understand :
//==================================
// Sending email with gmail Server :
//==================================
// This is a compilation of code providing from Web and Unigui Forum.
// So thx to all of them
// Step by Step :
//1. if you have not a gmail account, Create it.
//2. Important :
// - Enter in your Personnal Setting (gmail) and look for "Security"
// - Activate something like : "Allow less secure apps "
//3. Download (and Copy on the same executable folder ...\debug\) the two open SSL Libraries : libeay32.dll and ssleay32.dll.
(you can find them in C:\...FmSoft\..\SSL)
Important:
- if your unigui app is deployed on iis ( ISAPI), then copy them on system32 or syswow64 .
- if it is deployed as Service / hyperserver, then keep them behind your exe file (same directory)
//4. Connect internet and launch this program
Have Fun
Sending_Email.zip
Edit :
On Unit Cls_email : Modify this with your emal adress :
IdSMTP.Username :='MyAdress@gmail.com'; // (1)
IdSMTP.Password :='Mypw';
IdMessage.From.Address :='MyAdress@gmail.com'; // the same in (1)
Personnal Setting (gmail) " Allow less secure apps " :