5.7.57 SMTP - Client was not authenticated to send anonymous mail during MAIL FROM error

client was not authenticated to send anonymous mail during mail from exchange 2016
the smtp server requires a secure connection or the client was not authenticated office 365
client was not authenticated to send anonymous mail during mail from jenkins
530 5.7.57 smtp; client was not authenticated to send anonymous mail during mail from exchange 2016
client was not authenticated to send anonymous mail during mail from jira
cdo client was not authenticated to send anonymous mail during mail from
outlook 2010 client was not authenticated to send anonymous mail
smtp send anonymous email

I have to send mails using my web application. Given the below code showing The SMTP server requires a secure connection or the client was not authenticated. The server response was:

5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM.

Help me to find a proper solution. Thank you.

Code:

protected void btnsubmit_Click(object sender, EventArgs e)
 {

   Ticket_MailTableAdapters.tbl_TicketTableAdapter tc;
   tc = new Ticket_MailTableAdapters.tbl_TicketTableAdapter();
   DataTable dt = new DataTable();
   dt = tc.GetEmail(dpl_cate.SelectedValue);
   foreach (DataRow row in dt.Rows)
    {
    string eml = (row["Emp_Email"].ToString());
    var fromAddress = "emailAddress";
    var toAddress = eml;
    const string fromPassword = "*****";
    string body = "Welcome..";
 // smtp settings
    var smtp = new System.Net.Mail.SmtpClient();
       {
         smtp.Host = "smtp.office365.com";
         smtp.Port = 587;
         smtp.EnableSsl = true;

         smtp.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
         smtp.Credentials = new NetworkCredential(fromAddress, fromPassword);
         smtp.UseDefaultCredentials = false;
         smtp.Timeout = 600000;
       }
  // Passing values to smtp object
     smtp.Send(fromAddress, toAddress, subject, body);
     }
  } 
 }

I might not be a good programmer, but you seem to be passing the From address as "emailAddress" which is not a proper email address and for Office365 the from needs to be a real address on the Office365 system.

You can validate that if you hardcode your email address as the from and your office 365 password. Don't leave it there though of course.

Exception: The SMTP server requires a secure connection or the , Please check out Client was not authenticated to send anonymous mail was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL Yet i dont know why I keep getting this error when sending an email externally. SMTP server response:530 5.7.57 SMTP, Client was not authenticated to send anonymous mail during MAIL FROM [BN6PRO6CA0046.namprd11.prod.outlook.com]" Cause Office365 require authenticated account credentials to be added in the DS-Client in order to send the email.

@Reshma- In case you have not figured it yet, here are below things that I tried and it solved the same issue.

  1. Make sure that NetworkCredentials you set are correct. For example in my case since it was office SMTP, user id had to be used in the NetworkCredential along with domain name and not actual email id.

  2. You need to set "UseDefaultCredentials" to false first and then set Credentials. If you set "UseDefaultCredentials" after that it resets the NetworkCredential to null.

Hope it helps.

SMTP Error: 5.7.57 SMTP / Client was not authenticated to send , SMTP Error: 5.7.57 SMTP / Client was not authenticated to send anonymous mail​. Rasmus Jensen June 25, 2019 02:14. There are multiple possible reasons for this error. Reason 1. Missing or incorrect Login info. Solution 1. SMTP Settings  The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM. Help me to find a proper solution. Help me to find a proper solution. Thank you.

I spent way too much time on this and the solution was super simple. I had to use my "MX" as the host and port 25.

        var sClient = new SmtpClient("domain-com.mail.protection.outlook.com");
        var message = new MailMessage();

        sClient.Port = 25;
        sClient.EnableSsl = true;
        sClient.Credentials = new NetworkCredential("user", "password");
        sClient.UseDefaultCredentials = false;

        message.Body = "Test";
        message.From = new MailAddress("test@test.com");
        message.Subject = "Test";
        message.CC.Add(new MailAddress("dude@good.com"));

        sClient.Send(message);

The server response was: 5.7.57 SMTP; Client was not , 57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM. I have to send mail using my web application. Given below code showing error. The error is : The SMTP server requires a secure connection or the client was not authenticated. Instead try pointing the mail client toyour tenancy address (do an mxlookup and see what the mail.protection address is and try pointing your client there) mxtoolbox.com 1

I use to have the same problem.

Add the domain solved it..

mySmtpClient.Credentials = New System.Net.NetworkCredential("email@domain.com", "password", "domain.com")

The server response was: 5.7.57 SMTP Client was no, 57 SMTP Client was not authenticated to send anonymous mail during MAIL FROM. Symptoms. Getting the error below when using emails via K2Designer. Config:  The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [HE1PR05CA0133.eurprd05.prod.outlook.com] " on the article linked below. Send SMTP email using System.Net.Mail via Exchange Online (Office 365) My code seen below.

Main two reasons only as mentioned in above comments

  1. NetworkCredentials you set should be correct. Verify with try actually signing into the account.
  2. You need to set UseDefaultCredentials to false first and then set Credentials Or Put smtp.UseDefaultCredentials = false; above the smtp.Credentials assignment.

Cannot send outgoing email via Office365: 5.7.57 SMTP; Client was , outbound mail fails, and the error in the HEAT logs is: The SMTP SMTP; Client was not authenticated to send anonymous mail during MAIL  When you use Direct Send, you can send mail without authenticating. This is useful for printers, scanners, other devices, and applications but is not recommended for Outlook or other email client. When you use Outlook, you should use auto account setup and set the account up as a Microsoft Exchange account.

Client was not authenticated to send anonymous email during MAIL , The following error appears when saving a ticket in Web Help Desk: 530.5.7.57 SMTP; Client was not authenticated to send anonymous email  SMTP server error: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM I was looking at other questions but they seem to be referring to phpmailer and I am not sure if vtiger is using a different type of mailer.php form.

Using O365 to send anonymous emails receive "530 5.7.57 SMTP , I get an error as "530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM *****". When I use the same  Setting up email notifications on WSUS keep getting the following error: System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM

[SOLVED] SMTP Server Office 365, Setting up email notifications on WSUS keep getting the following error: was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL​  Server returned status code 530 - The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated Exception details: Message: The SMTP server requires a secure connection or the client

Comments
  • why not increase the Timeout?
  • Did you anonymize this, or are you actually trying to send over office.com with that login?
  • @reshma, What changes did you make? Facing the same issue.
  • I've been ableto send an email with the SMTP config shown, but I moved smtp.UseDefaultCredentials = false; before smtp.Credentials = ... as Kiquenet write below
  • That's it! I didn't know "UseDefaultCredentials" clears the Credentials. Thanks!
  • In my case, it doesn't matter which one goes first. As long as the "UseDefaultCredentials" is false. It works. I wonder why.
  • This one is worked for me. check this Microsoft article support.office.com/en-us/article/…
  • for me sClient.EnableSsl = true; was not defined.
  • You need to set "UseDefaultCredentials" to false first and then set Credentials. If you set "UseDefaultCredentials" after that it resets the NetworkCredential to null.
  • How you get the MX value ?