Created
May 18, 2011 14:54
-
-
Save iamjonbradley/978735 to your computer and use it in GitHub Desktop.
Attach VCARD with Zend_MAIL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include ('Zend/Mime.php'); | |
include ('Zend/Mail/Transport/Abstract.php'); | |
include ('Zend/Mail.php'); | |
$mail = new Zend_Mail(); | |
// create the vcard | |
$vcardText="BEGIN:VCARD\n VERSION:2.1\nFN:[name]\TEL;HOME;VOICE:[phone]\nEMAIL;PREF;INTERNET:[email]\nEND:VCARD"; | |
$vcardText = str_replace("[name]", $member['name'], $vcardText); | |
$vcardText = str_replace("[email]", $member['email'], $vcardText); | |
$vcardText = str_replace("[phone]", $member['phone'], $vcardText); | |
$at = $mail->createAttachment($vcardText); | |
$at->type = 'text/x-vcard'; | |
$at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT; | |
$at->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE; | |
$at->filename = 'contact.vcf'; | |
// set the email | |
$mail->addTo($row['sellerEmail'], $row['sellerName']); | |
$mail->setFrom($member['email'], $member['name']); | |
$mail->setSubject($subject); | |
$mail->setBodyText($message); | |
$mail->send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment