Index: twisted/mail/test/test_options.py
===================================================================
--- twisted/mail/test/test_options.py	(revision 34682)
+++ twisted/mail/test/test_options.py	(working copy)
@@ -12,6 +12,7 @@
 from twisted.mail.tap import Options, makeService
 from twisted.python.filepath import FilePath
 from twisted.internet import endpoints, defer
+from twisted.python import util
 
 
 class OptionsTestCase(TestCase):
@@ -140,8 +141,9 @@
         The deprecated I{--pop3s} and I{--certificate} options set up a POP3 SSL
         server.
         """
+        certPath = util.sibpath(__file__, "server.pem")
         cert = FilePath(self.mktemp())
-        cert.setContent("")
+        cert.setContent(file(certPath).read())
         options = Options()
         options.parseOptions(['--pop3s', '8995',
                               '--certificate', cert.path])
Index: twisted/mail/test/server.pem
===================================================================
--- twisted/mail/test/server.pem	(revision 0)
+++ twisted/mail/test/server.pem	(revision 0)
@@ -0,0 +1,36 @@
+-----BEGIN CERTIFICATE-----
+MIIDBjCCAm+gAwIBAgIBATANBgkqhkiG9w0BAQQFADB7MQswCQYDVQQGEwJTRzER
+MA8GA1UEChMITTJDcnlwdG8xFDASBgNVBAsTC00yQ3J5cHRvIENBMSQwIgYDVQQD
+ExtNMkNyeXB0byBDZXJ0aWZpY2F0ZSBNYXN0ZXIxHTAbBgkqhkiG9w0BCQEWDm5n
+cHNAcG9zdDEuY29tMB4XDTAwMDkxMDA5NTEzMFoXDTAyMDkxMDA5NTEzMFowUzEL
+MAkGA1UEBhMCU0cxETAPBgNVBAoTCE0yQ3J5cHRvMRIwEAYDVQQDEwlsb2NhbGhv
+c3QxHTAbBgkqhkiG9w0BCQEWDm5ncHNAcG9zdDEuY29tMFwwDQYJKoZIhvcNAQEB
+BQADSwAwSAJBAKy+e3dulvXzV7zoTZWc5TzgApr8DmeQHTYC8ydfzH7EECe4R1Xh
+5kwIzOuuFfn178FBiS84gngaNcrFi0Z5fAkCAwEAAaOCAQQwggEAMAkGA1UdEwQC
+MAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRl
+MB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dG8xEjAQ
+BgNVBAMTCWxvY2FsaG9zdDEdMBsGCSqGSIb3DQEJARYObmdwc0Bwb3N0MS5jb20w
+XDANBgkqhkiG9w0BAQEFAANLADBIAkEArL57d26W9fNXvOhNlZzlPOACmvwOZ5Ad
+NgLzJ1/MfsQQJ7hHVeHmTAjM664V+fXvwUGJLziCeBo1ysWLRnl8CQIDAQABoAAw
+DQYJKoZIhvcNAQEEBQADQQA7uqbrNTjVWpF6By5ZNPvhZ4YdFgkeXFVWi5ao/TaP
+Vq4BG021fJ9nlHRtr4rotpgHDX1rr+iWeHKsx4+5DRSy
+-----END CERTIFICATE REQUEST-----
Index: twisted/mail/test/test_mail.py
===================================================================
--- twisted/mail/test/test_mail.py	(revision 34682)
+++ twisted/mail/test/test_mail.py	(working copy)
@@ -2031,6 +2031,25 @@
             raise smtp.SMTPBadRcpt(user)
 
 
+
+class SSLContextFactoryTests(unittest.TestCase):
+    """
+    Tests for twisted.mail.protocols.SSLContextFactory.
+    """
+
+
+    def test_deprecation(self):
+        """
+        Test deprecation of twisted.mail.protocols.SSLContextFactory.
+        """
+        mail.protocols.SSLContextFactory('')
+        warningsShown = self.flushWarnings([self.test_deprecation])
+        self.assertEqual(len(warningsShown), 1)
+        self.assertIdentical(warningsShown[0]['category'], DeprecationWarning)
+        self.assertEqual(warningsShown[0]['message'], 'twisted.mail.protocols.SSLContextFactory was deprecated in Twisted 12.2.0: Use twisted.internet.ssl.DefaultOpenSSLContextFactory instead.')
+
+
+
 from twisted.python.runtime import platformType
 import types
 if platformType != "posix":
Index: twisted/mail/topfiles/4963.removal
===================================================================
--- twisted/mail/topfiles/4963.removal	(revision 0)
+++ twisted/mail/topfiles/4963.removal	(revision 0)
@@ -0,0 +1 @@
+twisted.mail.protocols.SSLContextFactory is now deprecated.
\ No newline at end of file
Index: twisted/mail/tap.py
===================================================================
--- twisted/mail/tap.py	(revision 34682)
+++ twisted/mail/tap.py	(working copy)
@@ -16,7 +16,7 @@
 from twisted.mail import relaymanager
 from twisted.mail import alias
 
-from twisted.mail.protocols import SSLContextFactory
+from twisted.internet.ssl import DefaultOpenSSLContextFactory
 
 from twisted.internet import endpoints
 
@@ -271,7 +271,7 @@
         category=DeprecationWarning, stacklevel=3)
 
     if certificate:
-        ctx = SSLContextFactory(certificate)
+        ctx = DefaultOpenSSLContextFactory(certificate, certificate)
         return endpoints.SSL4ServerEndpoint(reactor, port, ctx)
     return endpoints.TCP4ServerEndpoint(reactor, port)
 
Index: twisted/mail/protocols.py
===================================================================
--- twisted/mail/protocols.py	(revision 34682)
+++ twisted/mail/protocols.py	(working copy)
@@ -12,6 +12,8 @@
 from twisted.internet import defer
 from twisted.copyright import longversion
 from twisted.python import log
+from twisted.python.deprecate import deprecatedModuleAttribute
+from twisted.python.versions import Version
 
 from twisted import cred
 import twisted.cred.error
@@ -209,10 +211,14 @@
 # can be changed, of course.
 #
 class SSLContextFactory:
-    """An SSL Context Factory
-    
+    """
+    An SSL Context Factory.    
     This loads a certificate and private key from a specified file.
     """
+
+    deprecatedModuleAttribute(Version("Twisted", 12, 2, 0), "Use twisted.internet.ssl.DefaultOpenSSLContextFactory instead.", "twisted.mail.protocols", "SSLContextFactory")
+
+
     def __init__(self, filename):
         self.filename = filename
 
