🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

CompuMaster.Net.Smtp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

CompuMaster.Net.Smtp

Package Description

2025.1.10.100
Source
NuGet
Version published
Maintainers
1
Created
Source

CompuMaster.Network.Smtp

SMTP messaging with support for alternative body and embedded images

Simple download/installation using NuGet

Install-Package CompuMaster.Network.Smtp

Sample: Quick initialization of SMTP component

C#

using System.Collections.Generic;
using CompuMaster.Net.Smtp;
...
SmtpWorker MySmtpWorker = new SmtpWorker();
MySmtpWorker.SmtpServerName = "localhost";
MySmtpWorker.SmtpServerPort = 465;
MySmtpWorker.SmtpAuthType = SmtpWorker.SmtpAuthTypes.LoginSsl;
MySmtpWorker.SmtpUserName = "user";
MySmtpWorker.SmtpPassword = "password";

VB.NET

Imports System.Collections.Generic
Imports CompuMaster.Net.Smtp
...
Dim MySmtpWorker As New SmtpWorker()
MySmtpWorker.SmtpServerName = "localhost"
MySmtpWorker.SmtpServerPort = 465
MySmtpWorker.SmtpAuthType = SmtpWorker.SmtpAuthTypes.LoginSsl
MySmtpWorker.SmtpUserName = "user"
MySmtpWorker.SmtpPassword = "password"

Sample: Prepare a message with alternative message parts and attachment for embedded image

C#

EMailAttachment MyAttachment = new EMailAttachment("logo_64x64.png", "logo");
List<EMailAttachment> Attachments = new List<EMailAttachment>(new EMailAttachment[] { MyAttachment });
EMailAddress Recipient = new EMailAddress(My.Settings.TestRecipientName, My.Settings.TestRecipientAddress);
EMailAddress Sender = new EMailAddress(My.Settings.TestSenderName, My.Settings.TestSenderAddress);
EMailAddress ReplyToAddress = Sender;
EMailMessage MyMessage = new EMailMessage(
         Recipient, 
         "TestSubject", 
         "Plain body", 
         "<h1>HTML body with embedded image</h1><img src=\"cid:" + MyAttachment.PlaceholderInMhtmlToBeReplacedByContentID + "\">", 
         Sender, 
         ReplyToAddress, 
         System.Text.Encoding.UTF8, 
         Attachments, 
         EMails.Priority.High, 
         EMails.Sensitivity.Normal, 
         false, 
         false, 
         (System.Collections.Specialized.NameValueCollection)null
         );

VB.NET

Dim MyAttachment As New EMailAttachment("logo_64x64.png", "logo")
Dim Attachments As New List(Of EMailAttachment)(New EMailAttachment() {MyAttachment})
Dim Recipient As New EMailAddress(My.Settings.TestRecipientName, My.Settings.TestRecipientAddress)
Dim Sender As New EMailAddress(My.Settings.TestSenderName, My.Settings.TestSenderAddress)
Dim ReplyToAddress As EMailAddress = Sender
Dim MyMessage As New EMailMessage(Recipient,
         "TestSubject",
         "Plain body",
         "<h1>HTML body with embedded image</h1><img src=""cid:" & MyAttachment.PlaceholderInMhtmlToBeReplacedByContentID & """>",
         Sender,
         ReplyToAddress,
         System.Text.Encoding.UTF8,
         Attachments,
         EMails.Priority.High,
         EMails.Sensitivity.Normal,
         False,
         False,
         CType(Nothing, Specialized.NameValueCollection)
         )

Sample: Send demo e-mail and check for exceptions

C#

CompuMaster.Net.Smtp.SmtpSendResult SendResult;
SendResult = MySmtpWorker.SendMessage(MyMessage);
if (SendResult.Success)
    System.Console.WriteLine("EMAIL SENT SUCCESSFULLY :-)");
else
    System.Console.WriteLine("FAILURE: " + SendResult.Exception.ToString());

VB.NET

Dim SendResult As CompuMaster.Net.Smtp.SmtpSendResult
SendResult = MySmtpWorker.SendMessage(MyMessage)
If SendResult.Success Then
    System.Console.WriteLine("EMAIL SENT SUCCESSFULLY :-)")
Else
    System.Console.WriteLine("FAILURE: " & SendResult.Exception.ToString)
End If

Keywords

CompuMaster

FAQs

Package last updated on 10 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts