ErickTreetops
ErickTreetops

Reputation: 3375

Error when sending email to mail.com from c# console

I'm trying to send an email from a .NET console app via Mail.com SMTP. I've triple checked the values, but I keep getting an error:

SMTP Error: MustIssueStartTlsFirst - The SMTP server requires a secure connection or the client was not authenticated. The server response was: Authentication required

Here is how I set it:

// Create an SMTP client
SmtpClient smtpClient = new SmtpClient(smtpHost, smtpPort)
{
    Credentials = new NetworkCredential(EmailUser, EmailPassword),
    EnableSsl = true, // Ensure SSL/TLS is enabled
    DeliveryMethod = SmtpDeliveryMethod.Network,
    UseDefaultCredentials = false
};

What am I doing wrong? As far as I can tell there is no 2-factor authentication required when using Mail.com

Upvotes: 0

Views: 55

Answers (0)

Related Questions