Search code examples
vb.netexchange-serversmtpclientmailkitmimekit

"Mailbox size limit exceeded" when sending mails on an empty exchange account with MailKit .Net


I am using MimeKit and Mailkit to send emails from my VB.NET application, through my own SMTP server (run on Windows Server 2016, with SmarterMail).

Until then, I was sending emails to [email protected] which is an alias of infos@mywebsite.com and it worked very well. This email account is a exchange account with more of 49 Gio free.

Since a few days, I've received this error : Mailbox size limit exceeded When a set a spy on it, this is what I get :

Exception screenshot

This is the log :

S: 235 Authentication successful
C: MAIL FROM:<[email protected]> SIZE=599
S: 250 OK <[email protected]> Sender ok
C: RCPT TO:<[email protected]>
S: 452 <[email protected]> Mailbox size limit exceeded
C: RSET
S: 250 OK

I don't understand why I get this error while my recipient account is pretty much empty.

  • When I try to send email from my outlook account to info@mywebsite, I get no error.
  • When I try to send emails from my code to anothers recipients, I get no error.
  • My disk space is very large on my mail serveur (almost 2 To).

This is my code :

Dim message As New MimeMessage()
message.From.Add(New MailboxAddress("My website", "[email protected]"))
message.To.Add(New MailboxAddress("My website", "[email protected]"))

message.Subject = "any subject"

Dim builder As New BodyBuilder()
builder.TextBody = textemail
builder.HtmlBody = htmlemail
message.Body = builder.ToMessageBody()

' SERVER SMTP
Using client As New MailKit.Net.Smtp.SmtpClient()
    client.ServerCertificateValidationCallback = (Function(sender, certificate, chain, sslPolicyErrors) True)
    client.Connect("mail.mysmtpserver.com", 587, MailKit.Security.SecureSocketOptions.None)
    client.Authenticate("Mailkit_SMTP_UserName", "Mailkit_SMTP_Password")
    client.Send(message)
    client.Disconnect(True)
End Using

Thanks a lot for any suggestion (I don't find any related topic on Google)


Solution

  • I've found what was wrong in my SMTP server : Smartermail has it own mailbox size configuration for any mail account, that is limited at 100Mb.

    You can change it by going on : your domain > Manage > Account