function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
$file = $path.$filename;
$file_size = filesize($file);
$handle = fopen($file, "r");
$content = fread($handle, $file_size);
fclose($handle);
$content = chunk_split(base64_encode($content));
$uid = md5(uniqid(time()));
$name = basename($file);
$header = "From: ".$from_name." <".$from_mail.">\r\n";
$header .= "Reply-To: ".$replyto."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; // use diff. tyoes here
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
$header .= $content."\r\n\r\n";
$header .= "--".$uid."--";
mail($mailto, $subject, "", $header);
}
Archive for September 28th, 2009
Send email with file attachments using PHP
September 28th, 2009Funny Apple store video, I fell in love at the Apple Store
September 28th, 2009The real problem with MLM and network marketing
September 28th, 2009It always surprises me the diverse opinions of MLM and network marketing. Some are very involved with it and treat it very seriously; it has even attracted celebrities authors like Robert Kiyosaki and Robert Allen who promote it. However, there is still a majority of the population that would consider you to be a charlatan pedaling snake oil after knowing that you are involved with MLM or network marketing.
Why is there a problem with MLM and Network Marketing?
Is it that the structure takes the form of a pyramid? That is just a tiered incentives and a lot of large companies use tiered incentives for their sales force. The entry sales person gets a percentage of what he or she sells and then that persons manager or boss gets additional incentives based on the performance of the sales people they are responsible for. Could it be because there is typically a cost of entry to become a member of an MLM or network marketing group? The, ‘pay to play’ paradigm doesn’t apply to just MLM or network marketing, it’s the standard franchising model that countless franchise businesses use. Do you think that the local installation of your favorite burger chain was a gift to the owner by the burger chain’s corporate office? No, the owner of the burger chain bought into the franchise, he or she ‘paid to play’. MLM and networking marketing are really no different in that respect.
There are probably as many illegal network marketing or MLM scams out there as there are blades of grass; where the money generated is from selling other people the business opportunity, to sell the business opportunity and no real merchandise or product is sold. Those systems are no more different than the famous, “mail a dollar to eight people on the list” scam. There are however, many businesses that have successfully established themselves as a network marketing or MLM company and have sold tangible products to consumers (that are just customers and not resellers of the business opportunity) all over the global; companies like Amway, Excel and Meleleuca to name a few. To hold these companies with the likeness of an obvious scam is a bit unrealistic.
Are a couple of well-known pyramid schemes enough to ‘poison the apple’ and give all network marketers a bad name?
I think that the real problem with the business of network marketing and MLM isn’t the business itself, after all it is just simply a business model; the real problem lies with some of the individuals that it attracts. The business itself is ideal for many reasons such as a low start-up costs, low overhead and the potential to make a lot of money.
Unfortunately, the strengths of network marketing and MLM are also it’s weaknesses. Since network marketing is easily adopted, it can be and is adopted by those who may not necessarily be qualified to own their own business (which is what true MLM or network marketing is, business ownership). Network marketing and MLM will inevitably attract (in addition to qualified individuals) people who; haven’t done well in their current business or profession, have no experience with business ownership and most importantly have an unrealistic expectation of the work effort involved in relation to the income achieved by the work effort.
There isn’t anything necessarily wrong with those characteristics; even some of the most successful network marketers entered into the industry with some of those very same characteristics. I’m only saying that is describes the lion’s share of network marketers and that very few of them (if any) do something about it. Many people in the business will end up over-selling their opportunity, come across as desperate, discuss their opportunity in social situations when it isn’t appropriate or even worse; knowingly describe their opportunity inaccurately. The latter of which is largely responsible for the negative disdain that most people have when thinking about MLM and network marketing.
How do we fix this?
The solution lies in perception. We have to fundamentally change the way we view network marketing and MLM by recognizing it for what it is. Network marketing and MLM are a business opportunities and the practitioners of are very much, independent business owners. Some fledgling marketers aren’t prepared to be responsible for the complete success or failure of an endeavor but that is what business ownership is all about. By taking network marketing and MLM more serious and treating it more like a traditional business those on the outside looking in will start to adopt the idea of network marketing and MLM more readily.
The CodeTree recommends iContact for marketing list management
Create a zip file from folder contents using PHP
September 28th, 2009class createDirZip extends createZip {
function get_files_from_folder($directory, $put_into) {
if ($handle = opendir($directory)) {
while (false !== ($file = readdir($handle))) {
if (is_file($directory.$file)) {
$fileContents = file_get_contents($directory.$file);
$this->addFile($fileContents, $put_into.$file);
}
elseif ($file != '.' and $file != '..' and is_dir($directory.$file)) {
$this->addDirectory($put_into.$file.'/');
$this->get_files_from_folder($directory.$file.'/', $put_into.$file.'/');
}
}
}
closedir($handle);
}
}
//USAGE
$createZip = new createDirZip;
$createZip->addDirectory('themes/');
$createZip->get_files_from_folder('blog/wp-content/themes/', 'themes/');
$fileName = 'tmp/archive.zip';
$fd = fopen ($fileName, 'wb');
$out = fwrite ($fd, $createZip->getZippedfile());
fclose ($fd);
$createZip->forceDownload($fileName);
@unlink($fileName);
