* * *

Author Topic: [Solved] XMailer: can't send mail on Linux  (Read 774 times)

lainz

  • Hero Member
  • *****
  • Posts: 2724
  • I'm coding :)
    • Lainz
[Solved] XMailer: can't send mail on Linux
« on: March 01, 2018, 04:14:40 pm »
Hi, anyone using XMailer to send mails on Linux? There is a configuration that must be done before using it?

https://github.com/MFernstrom/xmailer/

I get an exception:

Quote
SSL error: TSendMail

I have open ssl installed. It works fine on macOS and Windows, but not on Linux (Ubuntu).

I'm using Lazarus trunk (1.9) fpc trunk (3.1.1)

This is my code:

Code: Pascal  [Select]
  1. // real mail addresses
  2. RECIBE = 'aaa@bbb.com';
  3. ENVIA = 'aaa@ccc.com <aaa@ccc.com>';
  4. ENVIA_USUARIO = 'aaa@ccc.com';
  5. ENVIA_PASSWORD = 'password';
  6. ENVIA_HOST = 'smtp.live.com';
  7. ENVIA_PORT = '587';  
  8.  
  9. procedure TfrmSoporte.btnEnviarClick(Sender: TObject);
  10. var
  11.   Mail: TSendMail;
  12. begin
  13.   if not IsValidEmail(edCorreoElectronico.Text) then
  14.   begin
  15.     ShowMessage(rsIngreseCorreoValido);
  16.     exit;
  17.   end;
  18.   Mail := TSendMail.Create;
  19.   try
  20.     try
  21.       // Mail
  22.       Mail.Sender := ENVIA;
  23.       Mail.Receivers.Add(RECIBE);
  24.       Mail.Subject := 'Soporte ' + edUsuario.Text;
  25.       Mail.Message.Add('Empresa: ' + edEmpresa.Text);
  26.       Mail.Message.Add('Usuario: ' + edUsuario.Text);
  27.       Mail.Message.Add('Nombre: ' + edNombre.Text);
  28.       Mail.Message.Add('Correo Electrónico: ' + edCorreoElectronico.Text);
  29.       Mail.Message.Add('');
  30.       Mail.Message.Add('Detalle: ');
  31.       Mail.Message.AddStrings(mDetalle.Lines);
  32.       if (captura <> '') and (FileExists(captura)) then
  33.         Mail.Attachments.Add(captura);
  34.       if (config <> '') and (FileExists(config)) then
  35.         Mail.Attachments.Add(config);
  36.       // SMTP
  37.       Mail.Smtp.UserName := ENVIA_USUARIO;
  38.       Mail.Smtp.Password := ENVIA_PASSWORD;
  39.       Mail.Smtp.Host := ENVIA_HOST;
  40.       Mail.Smtp.Port := ENVIA_PORT;
  41.       //Mail.Smtp.SSL := True;
  42.       mail.Smtp.FullSSL := False;
  43.       Mail.Smtp.TLS := True;
  44.       Mail.Send;
  45.       ShowMessage(rsCorreoEnviado);
  46.       Self.Close;
  47.     except
  48.       on E: exception do
  49.         ShowMessage(rsCorreoNoEnviado + LineEnding + '(' + E.Message + ')');
  50.     end;
  51.   finally
  52.     Mail.Free;
  53.   end;
  54. end;
« Last Edit: March 01, 2018, 06:08:08 pm by lainz »

Trenatos

  • Sr. Member
  • ****
  • Posts: 334
  • Software developer - Open source contributor
Re: XMailer: can't send mail on Linux
« Reply #1 on: March 01, 2018, 05:27:42 pm »
Which version of Linux are you running? Your issue report on GitHub mentions Ubuntu, but which version and which architecture?

I'll see if I can take a stab at it, but Silvio Clecio is the creator of XMailer, I just wanted to retain a copy as he said he was going to remove it from his repos.

lainz

  • Hero Member
  • *****
  • Posts: 2724
  • I'm coding :)
    • Lainz
Re: XMailer: can't send mail on Linux
« Reply #2 on: March 01, 2018, 05:42:04 pm »
Which version of Linux are you running? Your issue report on GitHub mentions Ubuntu, but which version and which architecture?

I'll see if I can take a stab at it, but Silvio Clecio is the creator of XMailer, I just wanted to retain a copy as he said he was going to remove it from his repos.

Hi, is Ubuntu 17.10 64 bit , tested on a VM.

But I also tested on a fresh Elementary OS 64 bit in another VM and did not work as well.

Ok, just if you can, if not there is no problem. This has been added to Online Package Manager today, so it can be installed from Lazarus directly also.
« Last Edit: March 01, 2018, 05:44:22 pm by lainz »

lainz

  • Hero Member
  • *****
  • Posts: 2724
  • I'm coding :)
    • Lainz
Re: XMailer: can't send mail on Linux
« Reply #3 on: March 01, 2018, 06:07:56 pm »
Solved, it needs libssl-dev installed in order to work.

Trenatos

  • Sr. Member
  • ****
  • Posts: 334
  • Software developer - Open source contributor
Re: [Solved] XMailer: can't send mail on Linux
« Reply #4 on: March 01, 2018, 06:18:33 pm »
Great! Thanks for sharing the solution as well. I'll put a note on the GitHub about it as well

lainz

  • Hero Member
  • *****
  • Posts: 2724
  • I'm coding :)
    • Lainz
Re: [Solved] XMailer: can't send mail on Linux
« Reply #5 on: March 01, 2018, 06:19:12 pm »
Great! Thanks for sharing the solution as well. I'll put a note on the GitHub about it as well

It's already there! But I did not read the readme fully  :-[

Trenatos

  • Sr. Member
  • ****
  • Posts: 334
  • Software developer - Open source contributor
Re: [Solved] XMailer: can't send mail on Linux
« Reply #6 on: March 01, 2018, 06:23:51 pm »
Haha, no I just added it a few minutes ago    :)

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus