The following sample code demonstrates how to send Internet email over a secure connection to an SSL enabled SMTP server.
VB.Net Sample
Dim objSMTP As New SMTP
objSMTP.SMTPServers.Add("mail.domain.com", 465)
Dim objSSL As New SSL
objSMTP.Connect(objSSL.GetInterface())
Dim objMessage As New EmailMessage( _
"recipient@domain.com", "sender@domain.com", _
"Subject", "Body text", BodyPartFormat.Plain)
objSMTP.Send(objMessage)
objSMTP.Disconnect()
C# Sample
</span></pre><pre><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 10.0pt">SMTP objSMTP = new SMTP();<o:p></o:p></span></pre><pre><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 10.0pt">objSMTP.SMTPServers.Add("mail.domain.com", 465);<o:p></o:p></span></pre><pre><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 10.0pt">SSL objSSL = new SSL();<o:p></o:p></span></pre><pre><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 10.0pt">objSMTP.Connect(objSSL.GetInterface());<o:p></o:p></span></pre><pre><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 10.0pt">EmailMessage objMessage = new EmailMessage(<o:p></o:p></span></pre><pre><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 10.0pt"><span style="mso-tab-count: 1"> </span>"recipient@quiksoft.com", "sender@domain.com", <o:p></o:p></span></pre><pre><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 10.0pt"><span style="mso-tab-count: 1"> </span>"Subject", "Body text", BodyPartFormat.Plain);<o:p></o:p></span></pre><pre><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 10.0pt">objSMTP.Send(objMessage);<o:p></o:p></span></pre><pre><span style="FONT-SIZE: 11pt; COLOR: black; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 10.0pt">objSMTP.Disconnect();<span style="mso-spacerun: yes"> </span><o:p></o:p></span></pre>
<span style="FONT-SIZE: 11pt; FONT-FAMILY: 'Times New Roman'; mso-bidi-font-size: 14.0pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-weight: bold; mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-bidi-language: AR-SA">
Yeah, that's it, pretty easy huh? Communications with the mail server will take place on port 465 which is the standard port for SMTP data traveling over SSL connections. The SSL plug-in is interfaced with the SMTP component during the call to Connect(), and the email components take over from there.