Skip to content

turboSMTP/turboSMTP-csharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smtp mail server – professional SMTP service provider

turboSMTP-csharp SDK

The Official turboSMTP C#, .NetStandard, .NetCore SDK - enables .Net Developers to work with turboSMTP API efficiently.

Table of contents

Release notes

Changes to the SDK beginning with version 2.0.0 (August 2024) are tracked in [CHANGELOG.md][changes-file].

Getting Started

Requirements

  • .NET Framework 4.8+.
  • A turboSMTP account, sign up for free to send up to 6.000 FREE emails per month (No Obligation - No Credit card required).

API Key

Create your API Key from turboSMTP Dashboard.

Base URL

Sending Server URL (SendServerURL)

turboSMTP allows sending and receiving an email worldwide, for better sending experience, turboSMTP offers 2 regions.

For european region use the sending URL:

https://api.eu.turbo-smtp.com/api/v2

For other regions use the sending URL:

https://api.turbo-smtp.com/api/v2

General Server URL (ServerURL)

https://api.turbo-smtp.com/api/v2

Quick start with TurboSMTP Client

In order to facilitate construction and usage of TurboSMTPClientConfiguration, it´s been built as a combination of Builder + Singleton design patterns:

TurboSMTP Client Configuration Initialization

As stated above, TurboSMTPClientConfiguration uses a builder design pattern that allows to setup your ConsumerKey and Secret, ServerURL and SendServerURL, and your Timezone that will be used to consume time sensitive data, like when filtering data by dates.

using System.Configuration;
using TurboSMTP;

namespace ConsoleApp
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var config = new TurboSMTPClientConfiguration.Builder()
                .SetConsumerKey(ConfigurationManager.AppSettings["ConsumerKey"])
                .SetConsumerSecret(ConfigurationManager.AppSettings["ConsumerSecret"])
                .SetServerURL(ConfigurationManager.AppSettings["ServerUrl"])
                .SetSendServerURL(ConfigurationManager.AppSettings["SendServerUrl"])
                .SetTimeZone("-03:00")
                .Build();
        }
    }
}

TurboSMTP Client Configuration Usage

As stated above, TurboSMTPClientConfiguration uses a singleton design pattern, once it´s been already setup once (it´s suggested you setup anytime during your application initialization), you can simply access it´s Instance property as:

var configuration = TurboSMTPClientConfiguration.Instance

TurboSMTP Client Initialization

In order to create a TurboSMTPClient simply pass a TurboSMTPClientConfiguration to it´s constructor as:

var TSClient = new TurboSMTPClient(TurboSMTPClientConfiguration.Instance);

TurboSMTP Client Hello World Email example

using System.Threading.Tasks;
using TurboSMTP;
using TurboSMTP.Domain;

namespace ConsoleApp
{
    internal class Program
    {
        static async Task Main(string[] args)
        {
            //Create an Email Message
            var emailMessage = new EmailMessage.Builder()
                .SetFrom("sender@yourdomain.com")
                .AddTo("recipient@domain.com")
                .SetSubject("Hello World Simple Email")
                .SetHtmlContent("This email has been sent using <b>turboSMTP SDK</b>.")
                .Build();

            //Create a TurboSMTPClient Instance
            var TSClient = new TurboSMTPClient(TurboSMTPClientConfiguration.Instance);

            //Send your Email Message
            var result = await TSClient.Emails.SendAsync(emailMessage);
        }
    }
}

After executing the above code, result.Message should be OK and MessageID should contain a reference number to your sending operation, and you should have an email in the inbox of the to recipient. You can check the status of your email in the UI, or using TurboSMTPClient.Relays.QueryAsync() method. Alternatively, we can post events to a URL of your choice using our Event Webhooks. This gives you information about the events that occur as turboSMTP processes your email.

Usage

Contribute

Thank you for considering contributing to our SDK! We welcome all forms of contributions, including bug reports and feature requests.

Your feedback is invaluable in helping us improve and expand our SDK, please refere to our CONTRIBUTING guide for details.

For any inquiries, you can contact us at the following email address:

Email: sdk@turbo-smtp

Quick links:

Troubleshooting

Please see our troubleshooting guide for common library issues.

About

turboSMTP-csharp is maintained and funded by Turbo SMTP Company. The names and logos for turboSMTP-csharp are trademarks of TurboSMTP Company.

Support

If you need help using Turbo SMTP SDK, please check the TurboSMTP Support Help Center.

License

This SDK is licensed under the MIT License - see the LICENSE file for details.

About

The Official turboSMTP C#, .NetStandard, .NetCore SDK - API Library

Resources

License

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages