Drucken

Logo Bodoconsult EDV-Dienstleistungen GmbH

Bodoconsult.Core.Web.Mail

Autor: Bodoconsult EDV-Dienstleistungen GmbH, Robert Leisner

Nuget package

https://www.nuget.org/packages/Bodoconsult.Core.Web.Mail/

Github repository

https://github.com/RobertLeisner/Bodoconsult.Core.Web.Mail

About the library Bodoconsult.Core.Web.Mail

What does the library

Bodoconsult.Core.Web.Mail library is intended for apps which have to send (but not receive) SMTP mails like console apps.

Mass mail handling features are in an experimental state or work is in progress.

How to use the library

The source code contain a NUnit test classes, the following source code is extracted from. The samples below show the most helpful use cases for the library.

Send a simple mail with plain text

        var account = new MailAccount
        {
            SmtpServer = "smtp.test.de",
            SmtpPassword = "test123!",
            SmtpAccountName = "test@test.de",
            MailAddressSender = "noreply@test.de",
            UseSecureConnection = true
        };
		
        var smtp = new SmtpMailer(account);
        smtp.Init();

        smtp.SendMail("to@test.de", "Testmail", "dgdgdgdgdgs sfsgdgs sshshsh");

        Assert.IsTrue(true);

Send a HTML mail

        var account = new MailAccount
        {
            SmtpServer = "smtp.test.de",
            SmtpPassword = "test123!",
            SmtpAccountName = "test@test.de",
            MailAddressSender = "noreply@test.de",
            UseSecureConnection = true
        };

        var msg = new MailMessage {IsBodyHtml = true};


        var add = new MailAddress(account.MailAddressSender);
        msg.From = add;

        add = new MailAddress(TestHelper.GetTestReceiver());
        msg.To.Add(add);

        msg.Subject = "Bodoconsult.Core.Web.Mail: test mail";
        msg.Body = "<p>ajHA SADad asd AS Ddad</p>";

        var smtp = new SmtpMailer(account);
        smtp.Init();

        smtp.SendMail(msg);

About us

Bodoconsult (http://www.bodoconsult.de) is a Munich based software development company from Germany.

Robert Leisner is senior software developer at Bodoconsult. See his profile on http://www.bodoconsult.de/Curriculum_vitae_Robert_Leisner.pdf.

Licence for the library Bodoconsult.Core.Web.Mail

The MIT License (MIT)

Copyright (c) Bodoconsult EDV-Dienstleistungen GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

 

Drucken