Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3790324
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:17:49+00:00 2026-05-19T12:17:49+00:00

When using the system.net/mail web.config settings to configure my SmtpClient, it fails to deliver

  • 0

When using the system.net/mail web.config settings to configure my SmtpClient, it fails to deliver emails, with an “protocol error” described best by Base64 encoding and authentication problems:

Example:
With the following Config

<system.net>
    <mailSettings>
        <smtp from="email@server.com">
            <network host="servermail.outsourced.com"
                     port="2525" 
                     defaultCredentials="false" 
                     userName="username" 
                     password="password"/>
        </smtp>
    </mailSettings>
</system.net>

And the Code:

var tmp = new SmtpClient();

MailMessage msg = new MailMessage();
msg.Subject = "test";
msg.From = new MailAddress("me@server.com");
msg.To.Add(new MailAddress("me@server.com"));
msg.Body = "test";
tmp.Send(msg);

Produces the error message:

System.Net.Mail.SmtpException: The server committed a protocol violation The server response was: UGFzc3dvcmQ6
   at System.Net.Mail.MailCommand.CheckResponse(SmtpStatusCode statusCode, String response)
   at System.Net.Mail.SmtpTransport.SendMail(MailAddress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientException
& exception)
   at System.Net.Mail.SmtpClient.Send(MailMessage message)

However, in the following code where I manually set all the properties, the code runs without exception and the email is delivered.

var tmp2 = new SmtpClient("servermail.outsourced.com", 2525);
tmp2.Credentials = new NetworkCredential("username", "password");
tmp2.UseDefaultCredentials = false;

MailMessage msg = new MailMessage();
msg.Subject = "test";
msg.From = new MailAddress("me@server.com");
msg.To.Add(new MailAddress("me@server.com"));
msg.Body = "test";
tmp2.Send(msg);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T12:17:49+00:00Added an answer on May 19, 2026 at 12:17 pm

    I tried your config settings from within LINQPad against my hMailServer mail server, and they worked great. So, my guess is that the mail server you are communicating with is handshaking with the client in an unexpected fashion. When I was testing, I captured the SMTP log from my server, and here’s what it looked like (sanitized, of course):

    SENT: 220 my.mailserv.er ESMTP
    RECEIVED: EHLO CLIENTAPP
    SENT: 250-my.mailserv.er[nl]250-SIZE 25600000[nl]250 AUTH LOGIN
    RECEIVED: AUTH login bWFpbHRlc3RAbXkubWFpbHNlcnYuZXI=
    SENT: 334 UGFzc3dvcmQ6
    RECEIVED: ***
    SENT: 235 authenticated.
    RECEIVED: MAIL FROM:<mailtest@mailserv.er>
    SENT: 250 OK
    RECEIVED: RCPT TO:<happyuser@mailserv.er>
    SENT: 250 OK
    RECEIVED: DATA
    SENT: 354 OK, send.
    

    My server requires SMTP AUTH, and you can see that after my client sends the AUTH command, the server responds with status code 334, and the base-64 encoded representation of Password:. So, I’d recommend turning on the trace functionality for the SmtpClient so you can see what is occurring during both scenarios.

    I was running LINQPad 4.31, and my linqpad.config file contained:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.net>
        <mailSettings>
          <smtp from="mailtest@mailserv.er">
            <network host="my.mailserv.er" port="25" userName="mailtest@mailserv.er" password="supersecure"/>
          </smtp>
        </mailSettings>
      </system.net>
    </configuration>
    

    The LINQPad query was as follows:

    SmtpClient mailer = new SmtpClient();
    
    Guid g = Guid.NewGuid();
    g.Dump("Message GUID");
    
    MailMessage msg = new MailMessage();
    msg.Subject = "Test:" + g;
    msg.To.Add(new MailAddress("happyuser@mailserv.er"));
    msg.Body = "I HAS A BODY";
    mailer.Send(msg);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wondering what the best way to send bulk emails is using System.Net.Mail
I am using System::Net::Mail to send emails. I was questioned about is it able
Hi I'm using System.Net.Mail to send some HTML formatted emails. What is the correct
I am trying to send an email in ASP.NET using system.net.mail the problem is
Consider the following .Net ASMX web service with two web methods. using System; using
We have a website which we have re-designed and coded to work using System.Net.Mail
How can I send an email using SYstem.Net.Mail to an email address that is
am using system.net.mail to send email as shown below, but its too slow. it
using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; using System.IO; using System.Net; using System.Net.Mail;
I can get both System.Net.Mail and System.Web.Mail to work with GMail, but I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.