Lazarus

Free Pascal => Beginners => Topic started by: hugoengel2003 on May 16, 2014, 06:44:33 am

Title: Sending Email with Indy
Post by: hugoengel2003 on May 16, 2014, 06:44:33 am
I tried so hard to make a sending email aplication with Indy, but I didn't get!
Please, help-me!
Title: Re: Sending Email with Indy
Post by: JanRoza on May 16, 2014, 12:16:42 pm
What version of Windows, Lazarus, FPC?
What have you tried so far, show your project so people know what you did and what is wrong.
Crystal balls are rare these days  :D
Title: Re: Sending Email with Indy
Post by: Paul Breneman on May 16, 2014, 12:35:14 pm
It isn't Indy, but here is a two year old Free Pascal example using Synapse that might be helpful:
http://turbocontrol.com/easyemail.htm (http://turbocontrol.com/easyemail.htm)
Title: Re: Sending Email with Indy
Post by: ChrisF on May 16, 2014, 02:30:01 pm
Here is a simple test program.

This example is using directly the TIdSMTP class of Indy, but using  the corresponding visual component of Indy instead is of course also possible: see "Indy Clients Protocols (nz)" panel in the IDE component palette.

Fields that must absolutely be changed in this sample (in "TForm1.Button2Click" code):

-IdMessage.Recipients.EmailAddresses : must have a valid recipient email address

-IdSMTP.Host: probably your own SMTP server (i.e. SMTP server of your ISP)

-IdSMTP.Port: eventually, the port number of the targeted SMTP server (25 in this sample)

Change the other fields according to your own needs.


** EDIT (2014-06-09) ** : Updated version for this sample. Indy dependency has been added to the test project for portable consideration (direct path to Indy library no more needed).
Title: Re: Sending Email with Indy
Post by: mica on May 16, 2014, 03:41:23 pm
not Indy but Synapse

uses .....smtpsend....

SendToEx( MailFrom, MailTo, Subject, SMTPHost, MailData,  Username, Password)

http://synapse.ararat.cz/doc/help/smtpsend.html