Sometimes, you find some interesting files on the internet, and want them mail to you, your office, or a friend. Or it's just that your corporate proxy won't let you access a file you want.
Why bother sending it yourself with your mail client and your connection when your webserver and its fat dedicated line can do it for you ?
PHP Send File By Email is a script that you feed with a file URL — http://somewhere.com/somefile.zip — and that gets this file delivered into an email box, as a regular attachment.
The script is pretty simple. Nothing fancy, just doing what it's supposed to do.
- Mirrors on your webserver the remote file, then sends it by email as an attachment
- Files can be binary (exe, zip, images, …) or text (txt, html, uncompiled code …)
- Locally mirrored files can be deleted after they've been sent, or kept on your server for future use
- Simple and clean interface (see demo)
Download the file and edit the few lines at the beginning to suit your needs.
- sendfile.php (colorized html, copy & paste into a blank file but donâ€™t download it : itâ€™s colorized html, not code :)
- sendfile.txt (right click & save as .php)
Upload the script anywhere on your webserver, and create a directory according to what you specified when editing the script. Make sure this directory is readable and writeable by this PHP script (i.e. chmod 777)
The script needs PHP function fopen() to be enabled on your webserver (this is probably the case).
If the requested file is too big, sending it by email can fail, depending on the recipient mail server. As an example, GMail accounts bounce back files that are bigger than 10 MB.
If your webserver's or the file's server's connection is too slow, the script can exceed its maximum execution time (i.e. timeout, which is set at 30 seconds on most web servers). If this happens, you need to either switch to a decent host, a find a faster mirror for the file you are requesting :)
Want to share or tweet this page? Please use this short URL: http://ozh.in/l8