Example #1
0
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 $contents = curl_exec($ch);
 // close cURL resource, and free up system resources
 curl_close($ch);
 #$contents = file_get_contents('../vcard.vcf');
 // and save it to a temporary location (so that it gets a nice filename)
 $dir = '/tmp/' . md5(time());
 mkdir($dir);
 $tempFile = $dir . '/NeilCrosby.vcf';
 file_put_contents($tempFile, $contents);
 // send the email
 require 'geekMail-1.0.php';
 $geekMail = new geekMail();
 $geekMail->setMailType('text');
 $geekMail->setProtocol("smtp");
 $geekMail->setSmtpAuth(true);
 $geekMail->setSmtpHost("hostname");
 $geekMail->setSmtpPass("password");
 $geekMail->setSmtpUser("*****@*****.**");
 $geekMail->from('*****@*****.**', 'Neil Crosby');
 $geekMail->to($email);
 $geekMail->subject("Neil Crosby's vCard");
 $geekMail->message("Thanks for downloading my vCard.\n\nIf you're using an iPhone, scroll down to the bottom of the attached card to add it to your address book.\n\nDon't forget you can always get an up to date copy from http://neilcrosby.com/vcard");
 $geekMail->attach($tempFile);
 if ($geekMail->send()) {
     unlink($tempFile);
     header("Location: http://neilcrosby.com/vcard/via-email/sent/");
 } else {
     $errors = $geekMail->getDebugger();
     print_r($errors);
 }