<?
/*
BEGIN:VCARD
VERSION:3.0
N:Last;First;;;
FN:First Last
EMAIL;type=INTERNET;type=WORK;type=pref:email@server.com
TEL;type=WORK;type=pref:(555) 111-2222
TEL;type=HOME:(555) 222-3333
item1.ADR;type=HOME;type=pref:;;123 Some Street;City;State;12345;
item1.X-ABADR:us
item2.ADR;type=WORK:;;456 Another Ave.;Seedy;Staight;67890;USA
item2.X-ABADR:us
NOTE:This_is_a_note
END:VCARD
*/
    
    
if($Submit == "send form")
{
    
$unique time();
    
    
$contents "BEGIN:VCARD
VERSION:3.0
N:$lastname;$firstname;;;
FN:$firstname $lastname
EMAIL;type=INTERNET;type=WORK;type=pref:$emailaddress
TEL;type=WORK;type=pref:$workphone
TEL;type=HOME:$homephone
item1.ADR;type=HOME;type=pref:;;$homeaddress $homeaddress1;$homecity;$homestate;$homezip;
item1.X-ABADR:us
item2.ADR;type=WORK:;;$workaddress1 $workaddress2;$workcity;$workstate;$workzip;
item2.X-ABADR:us
NOTE:$note
END:VCARD"
;
    
    
$encoded_attach chunk_split(base64_encode($contents));
    
    
$subject "Saglo Tenant Update Form";
    
$headers .= "From: \"$firstname $lastname\" <$emailaddress>\n";
    
$headers .= "Reply-To: \"$firstname $lastname\" <$emailaddress>\n";
    
    
    
// 1 - 5, with 1 being high priority and 5 being lowest priority. 3 is medium and most email clients don't show a "flag" for 3.
    // Specifies "Urgent Message!" to those that support it
    
$headers .= "X-Priority: 3\n";

    
// Return Path for Errors
    
$headers .= "Return-Path: <$emailaddress>\n";
    
$headers .= "MIME-version: 1.0\n";
    
$headers .= "Content-type: multipart/mixed; ";
    
$headers .= "boundary=\"Message-Boundary\"\n";
    
$headers .= "Content-transfer-encoding: 7BIT\n";
    
$headers .= "X-attachments: Tenant_".$unique.".vcf";

    
$message "
First Name: $firstname
Last Name: $lastname
Email: $emailaddress

Title: $title
Company: $company

-----------------
Business Address:
$workaddress1
$workaddress2

City: $workcity
State: $workstate
Zip: $workzip

Phone: $workphone
Fax: $workfax
Cell: $workcell
-----------------

-----------------
Home Address:
$homeaddress1
$homeaddress2

City: $homecity
State: $homestate
Zip: $homezip

Phone: $homephone
-----------------

Note: $note
"
;
    
    
$body_top "--Message-Boundary\n";
    
$body_top .= "Content-type: text/plain; charset=US-ASCII\n";
    
$body_top .= "Content-transfer-encoding: 7BIT\n";
    
$body_top .= "Content-description: Mail message body\n\n";

    
$message $body_top $message;

    
$message .= "\n\n--Message-Boundary\n";
    
$message .= "Content-type: application/msexcel; name=\"Tenant_".$unique.".vcf\"\n";        
    
$message .= "Content-Transfer-Encoding: BASE64\n";
    
$message .= "Content-disposition: attachment; filename=\"Tenant_".$unique.".vcf\"\n\n";
    
$message .= "$encoded_attach\n";
    
$message .= "--Message-Boundary--\n";

    
// JUDI: EDIT THIS (or delete my line)
    
$to "someone@someserver.com";
    
    
mail($to$subject$message$headers);
    
    echo 
"<html><head><title>w00t!</title></head><body><h1>Message Sent to $to</h1></body></html>";
}
else
{
?>



<form name="address_form" id="address_form" method="post" action="<?=$PHP_SELF;?>">
<input name="recipient" type="hidden" value="judi@momathome.com" />
<input name="subject" type="hidden" id="subject" value="Saglo tenant update form" />
<input name="redirect" type="hidden" id="redirect" value="http://saglo.server267.com/confirmation.php" />
<table width="400" border="0" align="center" cellpadding="3" cellspacing="2">
<tr>
<td>First Name:</td>
<td>
<div align="left">
<input name="firstname" type="text" id="firstname" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>Last Name: </td>
<td><div align="left">
<input name="lastname" type="text" id="lastname" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>Email:</td>
<td>
<div align="left">
<input name="emailaddress" type="text" id="emailaddress" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>Title:</td>
<td><div align="left">
<input name="title" type="text" id="title" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>Company:</td>
<td><div align="left">
<input name="company" type="text" id="company" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td colspan="2">Business</td>
</tr>
<tr>
<td>Address:</td>
<td>
<div align="left">
<input name="workaddress1" type="text" id="workaddress1" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<div align="left">
<input name="workaddress2" type="text" id="workaddress2" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>City:</td>
<td>
<div align="left">
<input name="workcity" type="text" id="workcity" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>State:</td>
<td>
<div align="left">
<input name="workstate" type="text" id="workstate" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>Zip:</td>
<td>
<div align="left">
<input name="workzip" type="text" id="workzip" value="" size="10" maxlength="10" />
</div></td>
</tr>
<tr>
<td>Phone:</td>
<td>
<div align="left">
<input name="workphone" type="text" id="workphone" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>Fax:</td>
<td>
<div align="left">
<input name="workfax" type="text" id="workfax" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>cell:</td>
<td>
<div align="left">
<input name="workcell" type="text" id="workcell" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td colspan="2">Home</td>
</tr>
<tr>
<td>Address:</td>
<td>
<div align="left">
<input name="homeaddress1" type="text" id="homeaddress1" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<div align="left">
<input name="homeaddress2" type="text" id="homeaddress2" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>City:</td>
<td>
<div align="left">
<input name="homecity" type="text" id="homecity" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>State:</td>
<td>
<div align="left">
<input name="homestate" type="text" id="homestate" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>Zip:</td>
<td>
<div align="left">
<input name="homezip" type="text" id="homezip" value="" size="10" maxlength="10" />
</div></td>
</tr>
<tr>
<td>Phone:</td>
<td>
<div align="left">
<input name="homephone" type="text" id="homephone" value="" size="32" maxlength="64" />
</div></td>
</tr>
<tr>
<td>note:</td>
<td>
<div align="left">
<textarea name="note" cols="32" rows="10" id="note"></textarea>
</div></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><div align="left">
<input type="submit" name="Submit" value="send form" />
<input name="Reset" type="reset" value="clear form" />
</div></td>
</tr>
</table>
</form>

<?
// Closes out the "else" statement (so the form only shows
}
?>