Our users can send emails from our ASP.NET Web application on the click of a button. In our testing environment, there is a strange thing going on.
The first time the application tries to send the email, we get the exception:
Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender
The funny thing is, when the user clicks on the button again (so the application tries to send the email again), it works, and the email is sent.
If you wait a while, you'll get the error again, but clicking for the second time will send the email without problems. If you would be fast enough to send a new email, it would work.
This is the (simplified) code we use:
Dim smtpClient As New SmtpClient(<smtp mail server goes here>) smtpClient.UseDefaultCredentials = True mailMessage.From = New MailAddress(<from address>) smtpClient.Send(mailMessage)
This does work in the production environments though. We're using Microsoft Exchange, and so are our customers (the production environments).
Has anyone ever had anything similar (error the first time, works like a charm the second time)?