Prolateral Consulting Ltd
Prolateral Consulting Ltd
Support
Support
Knowledgebase Articles
Help
Setup examples
Support

Prolateral offers primary and backup domain (DNS) services, with servers in key geographic locations providing the best service possible.

Problem

How do I set up outbound SMTP using the .Net SmtpClient Class?
How do I set up outbound SMTP using .Net?
How do I use outMail in .NET?

Solution

The following examples of code assumes you have already got a fully functional webserver and the .Net Framework Installed

The below example of code shows you have to use outMail as the outgoing SMTP relay using the SmtpClient Class in the .Net Framework

Example below are in C# (CSharp) and VB.NET.


// Create the Mail Message MailMessage 
mail = new MailMessage();   

// Set the address information 
mail.From = new MailAddress("myaddress@example.com");  
mail.To.Add("sendingaddress@example.com");  

// Set the content of the email 
mail.Subject = "test email"; 
mail.Body = "This is an email!";  

// Send the message 
SmtpClient smtp = new SmtpClient("mxXXXXXX.smtp-engine.com"); 
smtp.EnableSsl = False; 
smtp.Credentials = New NetworkCredential("outmail-username", "outmail-password"); 
smtp.Port = 25; 
smtp.Send(Mail); 


' Create the Mail Message
Dim Mail As New MailMessage

' Set the address information
Mail.From = New MailAddress("myaddress@example.com") 
Mail.To.Add("sendingaddress@example.com")

' Set the content of the email
Mail.Subject = "test email"
Mail.Body = "This is an email!"

' Send the message
Dim SMTP As New SmtpClient("mxXXXXXX.smtp-engine.com")
SMTP.EnableSsl = False
SMTP.Credentials = New System.Net.NetworkCredential("outmail-username", "outmail-password")
SMTP.Port = 25
SMTP.Send(Mail)

' Example 2 with Safer Error trapping method

' Create the Mail Message
Using Mail As New MailMessage

	' Set the address information
	Mail.From = New MailAddress("myaddress@example.com") 
	Mail.To.Add("sendingaddress@example.com")

	' Set the content of the email
	Mail.Subject = "test email"
	Mail.Body = "This is an email!"

	' Send the message
	Using SMTP As New SmtpClient("mxXXXXXX.smtp-engine.com")
		SMTP.EnableSsl = False
		SMTP.Credentials = New System.Net.NetworkCredential("outmail-username", "outmail-password")
		SMTP.Port = 25
		SMTP.Send(Mail)
	End Using
End Using


Summary of server details

Outgoing server

mxXXXXXX.smtp-engine.com

As provided in your signup email.

Outgoing server protocol

SMTP

Outgoing server port

25, 465, 587, 2525 or 8025

Authentication Type

Basic Authentication, SSL and TLS supported

Username

As provided

Password

As provided

 

like it, love it, then share it. Share this article on social media.

Did you enjoy this article?

Disclaimer

The Origin of this information may be internal or external to Prolateral Consulting Ltd. Prolateral makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Prolateral makes no explicit or implied claims to the validity of this information. Any trademarks referenced in this document are the property of their respective owners.