Page 1 of 1

[No Bug] SendMail() PB 5.4x (forgot to install libcurl)

Posted: Wed Dec 16, 2015 8:11 pm
by infratec
Hi,

now SendMail() does not crash in thread
http://www.purebasic.fr/english/viewtop ... 23&t=62636

But now it is not working with or without thread.
And also on Debian 7 x64.

Still the same program for testing:

Code: Select all

EnableExplicit

Procedure Send(*Dummy)
 
  Protected.i Mail
  Protected Alarm$
 
  Mail = CreateMail(#PB_Any, "supervisor@smarthome.ednt.de", "Test")
  If Mail
    PrintN("created")
    Alarm$ = "That's the main body"
    PrintN("before SetMailBody")
    SetMailBody(Mail, Alarm$)
    PrintN("after SetMailBody")
    AddMailRecipient(Mail, "root@localhost", #PB_Mail_To)
    PrintN("after AddMailRecipient")
    If SendMail(Mail, "127.0.0.1")
      PrintN("success")
    Else
      PrintN("failed")
    EndIf
  EndIf
 
EndProcedure



Define.i Thread

InitNetwork()

OpenConsole()

PrintN("Called normal:")

Send(0)

PrintN("")
PrintN("Now as thread:")

Thread = CreateThread(@Send(), 0)
WaitThread(Thread)
It shows now always failed.

It works without problems with PB 5.31 x64

Bernd

Re: Again SendMail() PB 5.40 x64 and 5.41B3 x64

Posted: Thu Dec 17, 2015 9:46 am
by Fred
Did you install libcurl ?

Re: Again SendMail() PB 5.40 x64 and 5.41B3 x64

Posted: Thu Dec 17, 2015 9:53 am
by infratec
Hi,

no :oops:

But I'd checked the dependecies with ldd and this didn't show libcurl.
And since I didn't use something with ssl I thought it should work.

I'll test it immediately.

Bernd

Re: Again SendMail() PB 5.40 x64 and 5.41B3 x64

Posted: Thu Dec 17, 2015 9:54 am
by Fred
We load libcurl dynamically (dlopen()) that's why ldd tells nothing.

Re: [No Bug] SendMail() PB 5.4x (forgot to install libcurl)

Posted: Thu Dec 17, 2015 9:56 am
by infratec
Working!

Thread header changed accordingly.

Re: [No Bug] SendMail() PB 5.4x (forgot to install libcurl)

Posted: Thu Dec 17, 2015 9:58 am
by infratec
Maybe it will be a good idea to note this in the help file.
Or a message should be raised when the loading of the lib fails.

Re: [No Bug] SendMail() PB 5.4x (forgot to install libcurl)

Posted: Thu Dec 17, 2015 9:58 am
by Fred
I will add a note in the doc to mention it, as it's not obvious.

Re: [No Bug] SendMail() PB 5.4x (forgot to install libcurl)

Posted: Thu Dec 17, 2015 10:01 am
by infratec
A message in syslog or a message on stderr (if loading fails) would be better, since an application is often used on an other PC than the development.

Re: [No Bug] SendMail() PB 5.4x (forgot to install libcurl)

Posted: Thu Dec 17, 2015 10:06 am
by Fred
infratec wrote:A message in syslog or a message on stderr (if loading fails) would be better, since an application is often used on an other PC than the development.
Seems fair, added for the next version (and added to the doc as well).