Index: class.phpmailer.php
===================================================================
--- class.phpmailer.php	(revision 447)
+++ class.phpmailer.php	(working copy)
@@ -215,6 +215,12 @@
    * @var string
    */
   public $Password      = '';
+	
+  /**
+   * Sets Client Certificate path to authentication.
+   * @var string
+   */
+  public $SMTPCert      = false;
 
   /**
    * Sets the SMTP server timeout in seconds.
@@ -674,7 +680,7 @@
         $tls = ($this->SMTPSecure == 'tls');
         $ssl = ($this->SMTPSecure == 'ssl');
 
-        if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) {
+        if ($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout, $this->SMTPCert)) {
 
           $hello = ($this->Helo != '' ? $this->Helo : $this->ServerHostname());
           $this->smtp->Hello($hello);
@@ -2065,4 +2071,4 @@
     return $errorMsg;
   }
 }
-?>
\ No newline at end of file
+?>
Index: class.smtp.php
===================================================================
--- class.smtp.php	(revision 447)
+++ class.smtp.php	(working copy)
@@ -109,7 +109,7 @@
    * @access public
    * @return bool
    */
-  public function Connect($host, $port = 0, $tval = 30) {
+  public function Connect($host, $port = 0, $tval = 30, $cert = false) {
     // set the error val to null so there is no confusion
     $this->error = null;
 
@@ -125,11 +125,20 @@
     }
 
     // connect to the smtp server
-    $this->smtp_conn = @fsockopen($host,    // the host of the server
-                                 $port,    // the port to use
-                                 $errno,   // error number if any
-                                 $errstr,  // error message if any
-                                 $tval);   // give up after ? secs
+		if ($cert && is_file($cert))
+		{
+			$context = stream_context_create();
+			stream_context_set_option($context, 'ssl', 'verify_host', false);
+			stream_context_set_option($context, 'ssl', 'local_cert', $cert);
+			stream_context_set_option($context, 'ssl', 'verify_peer', false);
+			$this->smtp_conn = stream_socket_client($host .':'. $port, $errno, $errstr, $tval, STREAM_CLIENT_CONNECT, $context);
+		}
+		else
+			$this->smtp_conn = @fsockopen($host,    // the host of the server
+																	 $port,    // the port to use
+																	 $errno,   // error number if any
+																	 $errstr,  // error message if any
+																	 $tval);   // give up after ? secs
     // verify we connected properly
     if(empty($this->smtp_conn)) {
       $this->error = array("error" => "Failed to connect to server",
@@ -811,4 +820,4 @@
 
 }
 
-?>
\ No newline at end of file
+?>

