Sending mail with MimeKit and default email

266 Views Asked by At

I need send a mail from my program. Then I use MimeKit. The problem is when run the program in another computer, with another email configurated by default. So I need to use that default email on that computer.

My code is

        var message = new MimeMessage();
        message.From.Add(new MailboxAddress("CCCC", "[email protected]"));
        message.To.Add(new MailboxAddress("KKKK", "[email protected]"));
        message.Subject = "¿Cómo estás?";

        message.Body = new TextPart("plano")
        {
            Text = @"Kaixo Lorea"
        };

        using (var smtpClient = new SmtpClient())
        {
            smtpClient.Send(message);
        }
       

I'm working with C# and Windows 10

Thanks

1

There are 1 best solutions below

2
On

As far as I understand your question, you are asking how to read the SMTP server configuration settings from whatever email client program is configured on another system.

I doubt you'll have much luck with that.