Recent

Author Topic: E-mail Component  (Read 43993 times)

WTDdallas

  • Full Member
  • ***
  • Posts: 100
E-mail Component
« on: June 25, 2016, 03:19:52 am »
Is there an E-Mail Component that I can put into a project? Very Basic is fine.

No reason to re-invent the wheel if I don't have to  :D

or At Least Something I can Build on, Other than the Examples.
« Last Edit: June 25, 2016, 03:24:13 am by WTDdallas »

eric

  • Sr. Member
  • ****
  • Posts: 267
Re: E-mail Component
« Reply #1 on: June 25, 2016, 07:51:36 am »

Graeme

  • Hero Member
  • *****
  • Posts: 1492
    • Graeme on the web
Re: E-mail Component
« Reply #2 on: June 25, 2016, 11:49:28 am »
I would always recommend Indy 10.6 - it works very well, and I've used it for very basic and quite complex usage.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

WTDdallas

  • Full Member
  • ***
  • Posts: 100
Re: E-mail Component
« Reply #3 on: June 25, 2016, 03:25:34 pm »
I would always recommend Indy 10.6 - it works very well, and I've used it for very basic and quite complex usage.

Do you have Any Examples, you can share?  :D

The Indy Manual is 4400+ pages,  :o , hard to sift thru it and find what I need  :(

Graeme

  • Hero Member
  • *****
  • Posts: 1492
    • Graeme on the web
Re: E-mail Component
« Reply #4 on: June 25, 2016, 10:29:55 pm »
The Indy Manual is 4400+ pages,  :o , hard to sift thru it and find what I need  :(
A bit lazy are we?  Here is a link you should try:

  http://lmgtfy.com/?q=Indy+SMTP+sending+an+email


Code: Pascal  [Select][+][-]
  1. procedure TMailerForm.btnSendMailClick(Sender: TObject) ;
  2.  begin
  3.    StatusMemo.Clear;
  4.  
  5.    //setup SMTP
  6.    SMTP.Host := ledHost.Text;
  7.    SMTP.Port := 25;
  8.  
  9.    //setup mail message
  10.    MailMessage.From.Address := ledFrom.Text;
  11.    MailMessage.Recipients.EMailAddresses := ledTo.Text + ',' + ledCC.Text;
  12.  
  13.    MailMessage.Subject := ledSubject.Text;
  14.    MailMessage.Body.Text := Body.Text;
  15.  
  16.    if FileExists(ledAttachment.Text) then TIdAttachment.Create(MailMessage.MessageParts, ledAttachment.Text) ;
  17.  
  18.    //send mail
  19.    try
  20.      try
  21.        SMTP.Connect(1000) ;
  22.        SMTP.Send(MailMessage) ;
  23.      except on E:Exception do
  24.        StatusMemo.Lines.Insert(0, 'ERROR: ' + E.Message) ;
  25.      end;
  26.    finally
  27.      if SMTP.Connected then SMTP.Disconnect;
  28.    end;
  29.  
  30.  end;
  31.  
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Roland57

  • Hero Member
  • *****
  • Posts: 586
    • msegui.net
Re: E-mail Component
« Reply #5 on: June 26, 2016, 12:46:24 am »
Hello!

I'm certainly clumsy but I failed to install Indy. Maybe I will have more luck tomorrow.  :)

Another solution would be to use a command line tool and execute it from your program. I made a successful test, under Windows, with a tool named Send-It-Quiet.

Here is my code:

Code: Pascal  [Select][+][-]
  1. uses
  2.   SysUtils, ShellApi, Windows;
  3.  
  4. var
  5.   param: string;
  6.  
  7. begin
  8.   param := Format(
  9.     '-s %s -u %s -p %s -f %s -t %s -subject %s -body %s',
  10.     [
  11.       'smtp.orange.fr',
  12.       'xxx@orange.fr',
  13.       'mypassword',
  14.       'xxx@orange.fr',
  15.       'xxx@gmx.fr',
  16.       '"The subject"',
  17.       '"The body of the message"'
  18.     ]
  19.   );
  20.  
  21.   ShellExecute(
  22.     0,
  23.     'open',
  24.     'senditquiet.exe',
  25.     PChar(param),
  26.     'C:\SendItQuietDirectory',
  27.     SW_SHOWNORMAL
  28.   );
  29. end.

The code was tested under Windows 10, with Lazarus 1.6.

By the way, I don't understand the difference between the user (-u) and the sender (-f).  :-\
« Last Edit: June 26, 2016, 09:25:39 am by RolandC »
My projects are on Codeberg.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1290
Re: E-mail Component
« Reply #6 on: June 26, 2016, 01:35:08 am »
hello,
to send email , you can also use  synapse or lnet (latest version 0.6.6) .

Friendly, J.P
« Last Edit: June 26, 2016, 01:36:46 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

WTDdallas

  • Full Member
  • ***
  • Posts: 100
Re: E-mail Component
« Reply #7 on: June 26, 2016, 05:05:28 am »
Thanks for Synapse Link, Just new to EMails  %), At Least in programing I mean.

If I can't find a Drop-in solution, then time to learn, :D and It has examples. 8-)

« Last Edit: June 26, 2016, 05:13:10 am by WTDdallas »

eric

  • Sr. Member
  • ****
  • Posts: 267
Re: E-mail Component
« Reply #8 on: June 26, 2016, 08:29:10 am »
XMailer-master, which I linked to above, is based on Synapse, and provides a very simple way to send emails. Look at the demos.

Graeme

  • Hero Member
  • *****
  • Posts: 1492
    • Graeme on the web
Re: E-mail Component
« Reply #9 on: June 26, 2016, 06:08:19 pm »
I'm certainly clumsy but I failed to install Indy.
As with everything else, you don't need to "install" Indy to use it. Simply set the Unit Search Paths for the specific project and use the Indy classes like I've posted before. Simple as that.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

Roland57

  • Hero Member
  • *****
  • Posts: 586
    • msegui.net
Re: E-mail Component
« Reply #10 on: June 27, 2016, 06:54:15 am »
As with everything else, you don't need to "install" Indy to use it. Simply set the Unit Search Paths for the specific project and use the Indy classes like I've posted before. Simple as that.

Thank you for the hint. I will try again.
My projects are on Codeberg.

 

TinyPortal © 2005-2018