Re: [Lazarus] Sending e-mail from within Lazarus

2018-05-12 Thread Graeme Geldenhuys via Lazarus
On 2018-05-12 06:33, Bo Berglund via Lazarus wrote:
> Note that the old atozed forum was taken down on technical reasons a
> while ago and the old posts there are not yet available for browsing.
> Apparently they are working on a way to restore the old database.

I've always connected to their NNTP newsgroup servers at:

   news.atozed.com

Clearly that was not affected by the web forums. All old and new posts
are still there - and available to be searched. Lots of useful
information too.

Whenever I posted questions there, I got answers the same day or in 1
day. Very good support.


Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Sending e-mail from within Lazarus

2018-05-11 Thread Bo Berglund via Lazarus
On Sat, 12 May 2018 01:18:31 +0100, Graeme Geldenhuys via Lazarus
 wrote:

>Indy rocks!!!

+1

And additionally the support available at the Indy forum is very good!
https://www.atozed.com/forums/forumdisplay.php?fid=9

If you ask sensible questions you *will* get help there!

Note that the old atozed forum was taken down on technical reasons a
while ago and the old posts there are not yet available for browsing.
Apparently they are working on a way to restore the old database.


-- 
Bo Berglund
Developer in Sweden

-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Sending e-mail from within Lazarus

2018-05-11 Thread Brian via Lazarus
On 05/11/2018 08:18 PM, Graeme Geldenhuys via Lazarus wrote:
> On 2018-05-11 01:12, brian wrote:
>> I omitted to put in my original post that I'm running 64-bit Ubuntu
>> Studio. All the Indy examples I've been able to find seem to require
>> Windows DLLs to implement SSL/TLS.
> 
> It works just fine under Windows, Linux and FreeBSD too. I've testing
> them all. On Linux and Windows it uses the OpenSSL libraries - which
> normally comes standard with the system.
> 
> To save you some trouble, I've attached a fully working console demo.
> Edit the config.ini to match your details. Also edit the SMTP host name
> inside the program unit. Sending emails via Gmail requires a extra step
> - you need to log into your Gmail with a Web Browser and under security
> settings, authenticate the "unknown device". When the console app gives
> an error on the first run, it will output URL you can use to get to that
> settings page (thanks Google).
> 
> The "IndySecureMailClient.pas" implements a wrapper class for Indy's
> SMTP and SSL handling making it super easy to use. The wrapper class in
> fact adds all Indy's abilities of encryption for convenience. Indy rocks!!!
> 
> I hope that helps.
> 

Thank you. I'll take a close look at it all over the weekend. I much
prefer this sort of solution to trying to call one of the Linux 'mail
from command line' utilities.

Brian.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Sending e-mail from within Lazarus

2018-05-11 Thread Graeme Geldenhuys via Lazarus
On 2018-05-11 01:12, brian wrote:
> I omitted to put in my original post that I'm running 64-bit Ubuntu
> Studio. All the Indy examples I've been able to find seem to require
> Windows DLLs to implement SSL/TLS.

It works just fine under Windows, Linux and FreeBSD too. I've testing
them all. On Linux and Windows it uses the OpenSSL libraries - which
normally comes standard with the system.

To save you some trouble, I've attached a fully working console demo.
Edit the config.ini to match your details. Also edit the SMTP host name
inside the program unit. Sending emails via Gmail requires a extra step
- you need to log into your Gmail with a Web Browser and under security
settings, authenticate the "unknown device". When the console app gives
an error on the first run, it will output URL you can use to get to that
settings page (thanks Google).

The "IndySecureMailClient.pas" implements a wrapper class for Indy's
SMTP and SSL handling making it super easy to use. The wrapper class in
fact adds all Indy's abilities of encryption for convenience. Indy rocks!!!

I hope that helps.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp


indy_SecureEmail.7z
Description: application/7z-compressed
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Sending e-mail from within Lazarus

2018-05-10 Thread Alonso Cárdenas Márquez via Lazarus
2018-05-10 8:31 GMT-05:00 Brian via Lazarus :

> Does anybody have a working example of sending e-mail from a Lazarus
> program through their ISP's mail server (which requires SSL/TLS) that
> they'd be willing to share with me? I've been trying to follow
> Michael's writeup for using Synapse,  I'm getting a timeout error from
> deep within the Synapse code, and I don't know whether it's something
> that I've screwed up or some kind of incompatibility with the mail
> server - my ISP, of course, will only tell me to use Outlook or
> similar. :( If I try to step through with the debugger, I get a socket
> error of 110. The version of Synapse I'm using is (I think) 40.1, at
> least it's the version downloaded via the online package manager.
>
> I'm using Lazarus 1.8.2 and FPC 3.0.4 as downloaded from SourceForge.
>
> Thanks.
>
> --
>

Hi Brian

Try with the following:

https://github.com/silvioprog/brookframework/tree/master/plugins/xmailer

It is a great plugin for send email developed by Silvio. I use it to
sending emails from different hosts with SSL/TLS. It uses synapse (Look at
demo folder). Don't forget check if email ports are open for you by your
ISP. You just need smtp ports (25, 587) to sending emails.

Greetings
ACM
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Sending e-mail from within Lazarus

2018-05-10 Thread Graeme Geldenhuys via Lazarus
On 2018-05-10 14:31, Brian via Lazarus wrote:
> Does anybody have a working example of sending e-mail from a Lazarus
> program through their ISP's mail server (which requires SSL/TLS) that

I've been doing that for years, and have always used Indy components
since my Delphi 4 days. Indy also has a ton of working examples, very
simple to use components, and the support is fantastic (just like FPC
and Lazarus). The extra good news is that there are tons of examples and
solutions available with a quick internet search - even if those
solutions are for Delphi, they apply exactly the same for FPC/Lazarus.

The latest Indy code can be found here:

  https://svn.atozed.com:444/svn/Indy10/trunk

ps:
  You don't have to install the Indy components into Lazarus, you can
  use them via code only without problems. That's what I do. Simply set
  your search paths, or compile the runtime lazarus packages and
  associate the indy package as a dependency of your project.

A internet search _will_ give you your answer, but if you really are
stuck, I have working example code I can share. My programs can sent
emails via Gmail, Yahoo, Office365 or any other ISP.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Sending e-mail from within Lazarus

2018-05-10 Thread Denis Kozlov via Lazarus


Try the latest trunk version of Synapse code:
http://sourceforge.net/p/synalist/code/HEAD/tree/trunk/

You'll also need OpenSSL binaries:
https://wiki.openssl.org/index.php/Binaries

Here is a snippet of a working connection routine, although tested in 
Delphi only:




uses
  // "ssl_openssl" unit is required to use SSL / TLS
  mimemess, mimepart, synachar, ssl_openssl;

type
  TMailerSecurity = (
    msNONE,
    msSTARTTLS,
    msSSLTLS
  );

procedure TMailer.Connect(const AHost: String; APort: Integer;
  ASecurity: TMailerSecurity; AAuthenticate: Boolean;
  const AUsername, APassword: String);
begin
  SMTP := TSMTPSend.Create;

  if AAuthenticate then
  begin
    SMTP.UserName := AUsername;
    SMTP.Password := APassword;
  end;
  SMTP.TargetHost := AHost;
  SMTP.TargetPort := IntToStr(APort);
  SMTP.AutoTLS := (ASecurity = msSTARTTLS);
  SMTP.FullSSL := (ASecurity = msSSLTLS);
  SMTP.Timeout := 1; // 10 seconds

  if not SMTP.Login then
    raise EMailer.CreateSMTP('SMTP.Login', SMTP);

  if AAuthenticate then
    if not SMTP.AuthDone then
  raise EMailer.Create(sMailerNotAuthenticated);
end;



Regards,
Denis


On 10/05/2018 14:31, Brian via Lazarus wrote:

Does anybody have a working example of sending e-mail from a Lazarus
program through their ISP's mail server (which requires SSL/TLS) that
they'd be willing to share with me? I've been trying to follow
Michael's writeup for using Synapse,  I'm getting a timeout error from
deep within the Synapse code, and I don't know whether it's something
that I've screwed up or some kind of incompatibility with the mail
server - my ISP, of course, will only tell me to use Outlook or
similar. :( If I try to step through with the debugger, I get a socket
error of 110. The version of Synapse I'm using is (I think) 40.1, at
least it's the version downloaded via the online package manager.

I'm using Lazarus 1.8.2 and FPC 3.0.4 as downloaded from SourceForge.

Thanks.



--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Sending e-mail from within Lazarus

2018-05-10 Thread Brian via Lazarus
On 05/10/2018 09:42 AM, Carlos E. R. via Lazarus wrote:
> On 2018-05-10 15:31, Brian via Lazarus wrote:
>> Does anybody have a working example of sending e-mail from a Lazarus
>> program through their ISP's mail server (which requires SSL/TLS) that
>> they'd be willing to share with me?
> 
> I intend to code this soon, but I will simply call "mailx", an external
> program to do it. The classic method was to call the sendmail binary.
> 
> I use Linux, you did not say what you use.
> 

Ugh, sorry. 64-bit Ubuntu Studio 16, LTS.



-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Sending e-mail from within Lazarus

2018-05-10 Thread hdv@gmail via Lazarus
On 2018-05-10 15:42, Carlos E. R. via Lazarus wrote:
> On 2018-05-10 15:31, Brian via Lazarus wrote:
>> Does anybody have a working example of sending e-mail from a Lazarus
>> program through their ISP's mail server (which requires SSL/TLS) that
>> they'd be willing to share with me?
> 
> I intend to code this soon, but I will simply call "mailx", an external
> program to do it. The classic method was to call the sendmail binary.
> 
> I use Linux, you did not say what you use.

In addition to Carlos' suggestion, and if you use Windows, you could use Blat
[1] or even Powershell [2] to do this. It will not be "native", but it works.

I used to use perl (I have been completely addicted to it for non-GUI stuff for
decades now) or "The Bat!" in the past for this, but I don't know if "The Bat"
still exists.

[1] https://sourceforge.net/projects/blat/

[2]
https://www.howtogeek.com/120011/stupid-geek-tricks-how-to-send-email-from-the-command-line-in-windows-without-extra-software/

Grx HdV
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Sending e-mail from within Lazarus

2018-05-10 Thread Carlos E. R. via Lazarus
On 2018-05-10 15:31, Brian via Lazarus wrote:
> Does anybody have a working example of sending e-mail from a Lazarus
> program through their ISP's mail server (which requires SSL/TLS) that
> they'd be willing to share with me?

I intend to code this soon, but I will simply call "mailx", an external
program to do it. The classic method was to call the sendmail binary.

I use Linux, you did not say what you use.

-- 
Cheers / Saludos,

Carlos E. R.
(from 42.3 x86_64 "Malachite" at Telcontar)



signature.asc
Description: OpenPGP digital signature
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Sending e-mail from within Lazarus

2018-05-10 Thread Brian via Lazarus
Does anybody have a working example of sending e-mail from a Lazarus
program through their ISP's mail server (which requires SSL/TLS) that
they'd be willing to share with me? I've been trying to follow
Michael's writeup for using Synapse,  I'm getting a timeout error from
deep within the Synapse code, and I don't know whether it's something
that I've screwed up or some kind of incompatibility with the mail
server - my ISP, of course, will only tell me to use Outlook or
similar. :( If I try to step through with the debugger, I get a socket
error of 110. The version of Synapse I'm using is (I think) 40.1, at
least it's the version downloaded via the online package manager.

I'm using Lazarus 1.8.2 and FPC 3.0.4 as downloaded from SourceForge.

Thanks.

-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus