[Gambas-user] strange behaviour from commandline - empty mail attachments
Rolf-Werner Eilert
eilert-sprachen at ...221...
Thu Aug 15 13:34:13 CEST 2013
Am 15.08.2013 12:25, schrieb Bruce:
> On Thu, 2013-08-15 at 12:07 +0200, Rolf-Werner Eilert wrote:
>> I could build a client which prints a pdf from commandline and sends it
>> to someone via e-mail, the Cairo class makes the pdfs.
>>
>> My Gambas program is called by cron. It checks a mailbox and reads the
>> mails if any. These are contact forms. The data are then processed into
>> a pdf and the resulting pdf sent back to the person which sent the
>> contact form.
>>
>> The strange thing is, as long as I start the program by hand, everything
>> runs as expected. But when it is started by cron, the pdfs which are
>> sent back reach the recipient empty, i. e. 0 Bytes.
>>
>> Sending is achieved by an external Perl script named sendEmail, I shell
>> out to start it. (This is because the SMTP client in Gambas doesn't want
>> to send these mails via any of my providers, haven't found the reason yet.)
>>
>> But it doesn't seem to be this script's mistake. I tested the same
>> pdf-file with a special version of the program which jumped directly
>> into mail despatch, and when I started it from within the IDE,
>> everything ran fine, but from cron it would send 0 byte pdfs.
>>
>> This is slightly OT, but it might have to do with the way Gambas handles
>> Shells or file rights or something completely different... Does anyone
>> here have an idea?
>>
>> Rolf
>
> Hi Rolf,
>
> The first thing I'd be looking at is your working directories, I presume
> you are using temporary files somewhere. Don't forget that the cron
> daemon is running in a completely different environment to your User
> environment.
>
> hth
> Bruce
>
Just to make this complete, I did another test: Even when I start the
Gambas program from commandline by hand, it runs flawlessly. Mails are
sent and attachments arrive.
Yes, it really seems to be the cron environment which somehow confuses
the external script. If I don't get it running this way, would you see
another way? (Why only don't I get the SMTP client in Gambas running? It
would solve this problem... Alright, I'll start another thread for it...)
Rolf
More information about the User
mailing list