Skip to content

Commit ac73570

Browse files
Merge pull request CodeCowboyOrg#4 from kevgeni/sslversion
Add combobox to select ssl/tsl version.
2 parents d674319 + 013f836 commit ac73570

File tree

9 files changed

+83
-29
lines changed

9 files changed

+83
-29
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
1. Download the release under the "release" tab.
66
2. Supports Basic Authentication to SMTP server.
77
3. Supports Anonymous connection to SMTP Server.
8-
4. Supports SSL connection to SMTP server.
8+
4. Supports SSL connection to SMTP server in STARTSSL mode only. Does not support connecting to SMTP/SSL, SMTP over SSL, or SMTPS server on default port 465.
99
5. Runs on Windows.
1010

1111
![Image of Software](https://i.imgur.com/Z7NCEcm.png)

SimpleSmtpClient/Form1.Designer.cs

Lines changed: 48 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SimpleSmtpClient/Form1.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,29 @@ private void guiSendMail_Click(object sender, EventArgs e)
4444
if (guiUseSsl.Checked)
4545
{
4646
client.EnableSsl = true;
47+
48+
int sslVer = cmbSSLVersion.SelectedIndex;
49+
if (sslVer == 0 || sslVer == -1)
50+
{
51+
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault;
52+
}
53+
else if (sslVer == 1)
54+
{
55+
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
56+
}
57+
else if (sslVer == 2)
58+
{
59+
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
60+
}
61+
else if (sslVer == 3)
62+
{
63+
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls11;
64+
}
65+
else if (sslVer == 4)
66+
{
67+
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
68+
}
69+
//tls 1.3 not supported by .net framework 4.8 as of now.
4770
}
4871
MailMessage message = CreateMailMessage();
4972
client.Send(message);

SimpleSmtpClient/Form1.resx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@
112112
<value>2.0</value>
113113
</resheader>
114114
<resheader name="reader">
115-
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116116
</resheader>
117117
<resheader name="writer">
118-
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120-
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
120+
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
121121
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
122122
<value>
123123
AAABAAkAAAAAAAEAIABWTgAAlgAAAICAAAABACAAKAgBAOxOAABgYAAAAQAgAKiUAAAUVwEASEgAAAEA

SimpleSmtpClient/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
35+
[assembly: AssemblyVersion("2.0.0.0")]
36+
[assembly: AssemblyFileVersion("2.0.0.0")]

SimpleSmtpClient/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SimpleSmtpClient/Properties/Settings.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SimpleSmtpClient/SimpleSmtpClient.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<AppDesignerFolder>Properties</AppDesignerFolder>
1010
<RootNamespace>SimpleSmtpClient</RootNamespace>
1111
<AssemblyName>SimpleSmtpClient</AssemblyName>
12-
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
12+
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
1313
<FileAlignment>512</FileAlignment>
1414
<TargetFrameworkProfile />
1515
</PropertyGroup>
@@ -22,6 +22,7 @@
2222
<DefineConstants>DEBUG;TRACE</DefineConstants>
2323
<ErrorReport>prompt</ErrorReport>
2424
<WarningLevel>4</WarningLevel>
25+
<Prefer32Bit>false</Prefer32Bit>
2526
</PropertyGroup>
2627
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2728
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -31,6 +32,7 @@
3132
<DefineConstants>TRACE</DefineConstants>
3233
<ErrorReport>prompt</ErrorReport>
3334
<WarningLevel>4</WarningLevel>
35+
<Prefer32Bit>false</Prefer32Bit>
3436
</PropertyGroup>
3537
<ItemGroup>
3638
<Reference Include="System" />

SimpleSmtpClient/app.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
3+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

0 commit comments

Comments
 (0)