Using Microsoft Office MIME Types with MailKit

Recently I had problems with attaching a macro-enabled Excel workbook to an email. When it was received, the macro’s didn’t run correctly on the latest version of Microsoft Office. It did run correctly on Excel 2007. The workbook was being corrupted in the encoding into the email or decoding when its downloaded.
The following code will maintain the integrity of the Excel workbook when attached to an e-mail:

ContentType xlsmContent = new ContentType ("application/", "octet-steam");
builder.Attachments.Add ($"{Directory.GetCurrentDirectory ()}/Temp/workbook.xlsm", xlsmContent);

These are the MIME types for documents in Microsoft Office:

Ext MIME Type
.doc application/msword
.dot application/msword
.docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
.dotx application/vnd.openxmlformats-officedocument.wordprocessingml.template
.docm application/
.dotm application/
.xls application/
.xlt application/
.xla application/
.xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
.xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template
.xlsm application/
.xltm application/
.xlam application/
.xlsb application/
.ppt application/
.pot application/
.pps application/
.ppa application/
.pptx application/vnd.openxmlformats-officedocument.presentationml.presentation
.potx application/vnd.openxmlformats-officedocument.presentationml.template
.ppsx application/vnd.openxmlformats-officedocument.presentationml.slideshow
.ppam application/
.pptm application/
.potm application/
.ppsm application/

Add Contact to Maximizer Address Book with PHP

The class below is an example how to post data from a web form to the address book in Maximizer. The first thing you need to do is create a Web Form in Maximizer (Administration -> Web Forms). The PHP class below uses the fields that were created for the form (your form will have different fields). The class uses the “name” from <input> in the Maximizer Web Form for the PHP SaveToAddressBook() method. You also need to pass the “action” string from the <form> to the method. When the method is called, it won’t be displayed on the web page since its hidden by CSS, and its submitted automatically by a JavaScript button press.
The Maximizer generated Web Form isn’t complicated. If you remove all of the styling and validation code, you can easily use the <input> fields in any web application. The class below only has the essential code for posting the form.
—[ code ]———————————–
class MaxLibrary
// This is the “action” string in the <form> declaration.
private $_action;
// These are for the <input> fields in the form.
private $_first_name;
private $_last_name;
private $_company;
private $_phone;
private $_email;
public function __construct ($action, $first_name, $last_name, $company, $phone, $email)
$this->_action = $action;
$this->_first_name = $first_name;
$this->_last_name = $last_name;
$this->_company = $company;
$this->_phone = $phone;
$this->_email = $email;
// Load form with data and automatically press submit button to send data to Maximizer.
// The “name” in the <input> statements in this function must match the name in Maximizer
// generated form.
public function SaveToAddressBook ()
<div style=’display: none;’>
<form name=’form_maximizer’ method=’post’ action='<?php echo $this->_action; ?>’>
<input name=’C0IFirstName’ type=’text’ value='<?php echo $this->_first_name; ?>’><br>
<input name=’C1ILastName’ type=’text’ value='<?php echo $this->_last_name; ?>’><br>
<input name=’C2ICompanyName’ type=’text’ value='<?php echo $this->_company; ?>’><br>
<input name=’C3IPhone1′ type=’text’ value='<?php echo $this->_phone; ?>’><br>
<input name=’U4I58850′ type=’text’ value='<?php echo $this->_email; ?>’><br>
<script type=”text/javascript”>
window.onload=function ()

Real Time Code Compiler from Skype

Screen sharing apps are commonly used in business meetings where people aren’t sitting next to each other in a boardroom. Another use I have for them is in technical support for software where your client shows you on their computer what bug they discovered in your software.

Skype created an interesting way to do screen sharing. They created a real time code compiler where you can edit and compile code in C, C++, C#, Java, JavaScript, Python, or Ruby. This can be used for showing your programming skills during a job interview without being there in person. The site also shows a video of the people in the session so you can see the shocked look of the interviewer when they see brilliant code like my swap function (see below).

Screenshot 2017-09-01 21.22.53

The screen sharing compiler can be found at I’m guessing by the name its meant for job interviews Smile but there are other uses as well, such as students helping each other code.

This is a very useful site and it will probably wind up in the Skype application itself. It will run much better as an app than a web site when it comes to streaming audio and video.

How to Copy Contents of HTML Textbox to Another

I recently made changes to a web form that populated a PDF through an XFDF file. In the new code, instead of outputting to an XFDF, the page outputs to an HTML file. Everything worked great, except the HTML page lacked one feature the PDF did. If you have 2 fields with the same name on a PDF, when you update one field, the other field automatically gets the same content. This naming trick won’t work in HTML.
The sample code below will copy the contents of a textbox to another textbox without using JavaScript. The updates occur during each key press. I’ve include examples in standard HTML and ASP.NET. The red text is the code you use to copy one textbox to another.

<form name="aForm" action="" method="" />
  <input type="text" name="TextBox1" onkeyup="document.aForm.TextBox2.value = this.value" />
  <input type="text" name="TextBox2" />


<asp:TextBox ID="TextBox1" runat="server" onkeyup="document.aForm.TextBox2.value = this.value"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>