Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #6753 > unrolled thread

How to NOT send empty files via email?

Started bypauly814@gmail.com
First post2012-08-09 08:19 -0700
Last post2012-08-09 18:04 +0200
Articles 2 — 2 participants

Back to article view | Back to comp.lang.php


Contents

  How to NOT send empty files via email? pauly814@gmail.com - 2012-08-09 08:19 -0700
    Re: How to NOT send empty files via email? "J.O. Aho" <user@example.net> - 2012-08-09 18:04 +0200

#6753 — How to NOT send empty files via email?

Frompauly814@gmail.com
Date2012-08-09 08:19 -0700
SubjectHow to NOT send empty files via email?
Message-ID<3dcfc489-6244-4920-a975-ab9db64ffe10@googlegroups.com>
Hi,
I have a simple php page that grabs a .txt file if it exists and emails it.

I would like to modify it so that if the file is under 60 bytes, dont send it.

Here is what I am doing to send the file:
   $messageBody .=file_get_contents("d:\notes\note $filedate.txt");
   $messageBody .= "\n\r==============================================================\n\r";
   $messageBody .=file_get_contents("d:\notes\middaynote $filedate.txt");


ini_set("SMTP", "mailserver");
ini_set("smtp_port", "25"); 
$headers = "From: reports@company.com"; 


mail("myreport@company.com","Here are your reports $today",$messageBody,$headers);

thanks for any help

[toc] | [next] | [standalone]


#6754

From"J.O. Aho" <user@example.net>
Date2012-08-09 18:04 +0200
Message-ID<a8i5bhFsulU1@mid.individual.net>
In reply to#6753
On 09/08/12 17:19, pauly814@gmail.com wrote:
> Hi,
> I have a simple php page that grabs a .txt file if it exists and emails it.

In your example you don't.

> I would like to modify it so that if the file is under 60 bytes, dont send it.
>
> Here is what I am doing to send the file:
>     $messageBody .=file_get_contents("d:\notes\note $filedate.txt");
>     $messageBody .= "\n\r==============================================================\n\r";
>     $messageBody .=file_get_contents("d:\notes\middaynote $filedate.txt");

Check the size of what you get from file_get_contents() of use function 
like filesize()


-- 

  //Aho

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web