FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » How to NOT send empty files via email?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
How to NOT send empty files via email? [message #178824] Thu, 09 August 2012 15:19 Go to next message
Paul is currently offline  Paul
Messages: 3
Registered: February 2012
Karma: 0
Junior Member
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(at)company(dot)com";


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

thanks for any help
Re: How to NOT send empty files via email? [message #178825 is a reply to message #178824] Thu, 09 August 2012 16:04 Go to previous message
J.O. Aho is currently offline  J.O. Aho
Messages: 194
Registered: September 2010
Karma: 0
Senior Member
On 09/08/12 17:19, pauly814(at)gmail(dot)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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to make Apache to allow an executable to leave a file?
Next Topic: How to make Apache to allow an executable to leave a file?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Nov 24 15:26:27 GMT 2024

Total time taken to generate the page: 0.02653 seconds