{"id":319,"date":"2005-08-14T22:56:17","date_gmt":"2005-08-14T20:56:17","guid":{"rendered":"http:\/\/frenchfragfactory.net\/ozh\/my-projects\/php-send-file-by-email-sendmail-attachment\/"},"modified":"2007-04-21T16:09:54","modified_gmt":"2007-04-21T14:09:54","slug":"php-send-file-by-email-sendmail-attachment","status":"publish","type":"page","link":"https:\/\/planetozh.com\/blog\/my-projects\/php-send-file-by-email-sendmail-attachment\/","title":{"rendered":"PHP Send File By Email"},"content":{"rendered":"<p>Sometimes, you find some interesting files on the internet, and want them mail to you, your office, or a friend. Or it&#39;s just that your corporate proxy won&#39;t let you access a file you want.<\/p>\n<p>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 ?<\/p>\n<p><strong>PHP Send File By Email<\/strong> is a script that you feed with a file URL &mdash; http:\/\/somewhere.com\/somefile.zip &mdash; and that gets this file delivered into an email box, as a regular attachment.<\/p>\n<h2>Features<\/h2>\n<p>The script is pretty simple. Nothing fancy, just doing what it&#39;s supposed to do.<\/p>\n<ul>\n<li>Mirrors on your webserver the remote file, then sends it by email as an attachment<\/li>\n<li>Files can be binary (exe, zip, images, &#8230;) or text (txt, html, uncompiled code &#8230;)<\/li>\n<li>Locally mirrored files can be deleted after they&#39;ve been sent, or kept on your server for future use<\/li>\n<li>Simple and clean interface (see <a href=\"\/download\/sendfile-demo.html\">demo<\/a>)<\/li>\n<\/ul>\n<h2>Installation<\/h2>\n<p>Download the file and edit the few lines at the beginning to suit your needs.<\/p>\n<ul>\n<li><a href=\"http:\/\/planetozh.com\/download\/sendfile.php\">sendfile.php<\/a> (colorized html, copy &#038; paste into a blank file but don\u00e2\u20ac\u2122t download it : it\u00e2\u20ac\u2122s colorized html, not code :) <\/li>\n<li><a href=\"http:\/\/planetozh.com\/download\/sendfile.txt\">sendfile.txt<\/a> (right click &#038; save as .php)<\/li>\n<\/ul>\n<p>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. <em>chmod 777<\/em>)<\/p>\n<h2>Notes<\/h2>\n<p>The script needs PHP function <a href=\"http:\/\/php.net\/fopen\">fopen()<\/a> to be enabled on your webserver (this is probably the case).<\/p>\n<p>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.<\/p>\n<p>If your webserver&#39;s or the file&#39;s server&#39;s connection is too slow, the script can exceed its maximum execution time (i.e. <em>timeout<\/em>, 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 :)<\/p>\n<h2>Disclaimer<\/h2>\n<p>Prices, Specs, Availability, Terms, and Specials are subject to change without notice. Not responsible for inadvertent or typographical errors. Acceptance of the Terms of Use and Acceptable Use Policy is a condition of use. Please read all instructions and warnings before use. Must be 18 years of age or older to proceed further. Children under the age of 18 should have the consent of a parent before using. Use at your own risk. Any resemblance to persons living or dead is purely coincidental. No animal or computer harmed. Not my prettiest code. But it works :)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes, you find some interesting files on the internet, and want them mail to you, your office, or a friend. Or it&#39;s just that your corporate proxy won&#39;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":241,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-319","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/319","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/comments?post=319"}],"version-history":[{"count":0,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/319\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/pages\/241"}],"wp:attachment":[{"href":"https:\/\/planetozh.com\/blog\/wp-json\/wp\/v2\/media?parent=319"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}