Subscribe to
NSLog(); Header Image

vCard PHP

Awhile ago I helped Judi with a vCard/PHP problem. Someone requested the source code, so here it is as a web app (the email goes nowhere, so don't send use this) and as source code.

The trick is a very simple one: vCards are just plain text with some specialized formatting. I've used this same trick to send files as ".xls" files. You can't format the text, but double-clicking the tab-delimited .xls attachments opens them in Excel.

Use this or any modification as you see fit. Please give credit where credit is due.

8 Responses to "vCard PHP"

  1. Here's what I need to do daily: Look up data in a MySQL database.Insert that data into an Excel template.Email the Excel template. I can send a .xls file via email, but only the kind you can create by tab-delimiting...

  2. Comments are good

  3. I loaded vCard PHP and get the following error;<?=$PHP_SELF;?>

    Not Found

    The requested URL /< was not found on this server.

    Apache/2.0.48 (Unix) DAV/2 PHP/4.3.4 Server at Port 80

  4. Sean,

    Try <?php echo $_SERVER['PHP_SELF']; ?>. The $PHP_SELF variable does not work on newer versions of PHP in some configurations -- I believe this is when the 'register_globals' option is off.

  5. Cool, Just the script I've been looking for!

    I'm a PHP newb.. so pls bare with me :/

    Ok, so I've managed to get everything working exept that the script doesn't actually send out an email.

    (or at the very least I have'nt revieved one yet) 😛

    What am I going wrong?

  6. Pls forgive me, I'm such a dummy!

    I did get the email w/ attached vCard... It was caught up in my spam filter 😛

    FYI - I've noticed that I get an error when importing the vCard into a contact management software. I've tried changing the version variable (VERSION:3.0) to VERSION:2.1 and it seems to be working now! Any thoughts on why this error could have occurred? .. what are the differences between vCard vers. 2.1 and 3.0?

    Much appreciated 🙂

  7. It nearly works for me. Instead of getting a .vcf file I get a .dat file. If I save it to my desktop as a vcf then it works. Makes for a lotta work if i get quite a few emails tho... Any idea what's happening? Do you thin perhaps my server is stripping the file?

  8. where to set register_globe?